diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c3ba6106..03350953 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,18 +52,19 @@ repos: types: [python] - repo: "https://github.com/adrienverge/yamllint.git" - rev: v1.32.0 + rev: v1.33.0 hooks: - id: yamllint files: ^.*\.(yaml|yml)$ entry: yamllint --strict --config-file .yamllint.yml - repo: "https://github.com/charliermarsh/ruff-pre-commit" - rev: "v0.1.4" + rev: "v0.1.5" hooks: - id: ruff args: ["--extend-ignore", "I001,D301,D401"] exclude: tests/ + - id: ruff-format - repo: "https://github.com/jendrikseipp/vulture" rev: "v2.10" @@ -87,13 +88,6 @@ repos: pass_filenames: true types: [text] - - id: black - name: black - entry: black - require_serial: true - language: system - types: [python] - - id: shellcheck name: shellcheck entry: shellcheck --check-sourced --severity=warning diff --git a/poetry.lock b/poetry.lock index 6a8dd1e0..97126292 100644 --- a/poetry.lock +++ b/poetry.lock @@ -229,46 +229,6 @@ doc = ["Markdown (>=3.3)", "Pygments (>=2.8.0)", "jinja2 (>=3.0.3)", "mkdocs (>= queue = ["beanie-batteries-queue (>=0.2)"] test = ["asgi-lifespan (>=1.0.1)", "dnspython (>=2.1.0)", "fastapi (>=0.100)", "flake8 (>=3)", "httpx (>=0.23.0)", "pre-commit (>=2.3.0)", "pydantic-extra-types (>=2)", "pydantic-settings (>=2)", "pyright (>=0)", "pytest (>=6.0.0)", "pytest-asyncio (>=0.21.0)", "pytest-cov (>=2.8.1)"] -[[package]] -name = "black" -version = "23.11.0" -description = "The uncompromising code formatter." -optional = false -python-versions = ">=3.8" -files = [ - {file = "black-23.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dbea0bb8575c6b6303cc65017b46351dc5953eea5c0a59d7b7e3a2d2f433a911"}, - {file = "black-23.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:412f56bab20ac85927f3a959230331de5614aecda1ede14b373083f62ec24e6f"}, - {file = "black-23.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d136ef5b418c81660ad847efe0e55c58c8208b77a57a28a503a5f345ccf01394"}, - {file = "black-23.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:6c1cac07e64433f646a9a838cdc00c9768b3c362805afc3fce341af0e6a9ae9f"}, - {file = "black-23.11.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cf57719e581cfd48c4efe28543fea3d139c6b6f1238b3f0102a9c73992cbb479"}, - {file = "black-23.11.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:698c1e0d5c43354ec5d6f4d914d0d553a9ada56c85415700b81dc90125aac244"}, - {file = "black-23.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:760415ccc20f9e8747084169110ef75d545f3b0932ee21368f63ac0fee86b221"}, - {file = "black-23.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:58e5f4d08a205b11800332920e285bd25e1a75c54953e05502052738fe16b3b5"}, - {file = "black-23.11.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:45aa1d4675964946e53ab81aeec7a37613c1cb71647b5394779e6efb79d6d187"}, - {file = "black-23.11.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4c44b7211a3a0570cc097e81135faa5f261264f4dfaa22bd5ee2875a4e773bd6"}, - {file = "black-23.11.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a9acad1451632021ee0d146c8765782a0c3846e0e0ea46659d7c4f89d9b212b"}, - {file = "black-23.11.0-cp38-cp38-win_amd64.whl", hash = "sha256:fc7f6a44d52747e65a02558e1d807c82df1d66ffa80a601862040a43ec2e3142"}, - {file = "black-23.11.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7f622b6822f02bfaf2a5cd31fdb7cd86fcf33dab6ced5185c35f5db98260b055"}, - {file = "black-23.11.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:250d7e60f323fcfc8ea6c800d5eba12f7967400eb6c2d21ae85ad31c204fb1f4"}, - {file = "black-23.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5133f5507007ba08d8b7b263c7aa0f931af5ba88a29beacc4b2dc23fcefe9c06"}, - {file = "black-23.11.0-cp39-cp39-win_amd64.whl", hash = "sha256:421f3e44aa67138ab1b9bfbc22ee3780b22fa5b291e4db8ab7eee95200726b07"}, - {file = "black-23.11.0-py3-none-any.whl", hash = "sha256:54caaa703227c6e0c87b76326d0862184729a69b73d3b7305b6288e1d830067e"}, - {file = "black-23.11.0.tar.gz", hash = "sha256:4c68855825ff432d197229846f971bc4d6666ce90492e5b02013bcaca4d9ab05"}, -] - -[package.dependencies] -click = ">=8.0.0" -mypy-extensions = ">=0.4.3" -packaging = ">=22.0" -pathspec = ">=0.9.0" -platformdirs = ">=2" - -[package.extras] -colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)"] -jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] -uvloop = ["uvloop (>=0.15.2)"] - [[package]] name = "boto3" version = "1.28.80" @@ -1307,17 +1267,6 @@ files = [ {file = "pastel-0.2.1.tar.gz", hash = "sha256:e6581ac04e973cac858828c6202c1e1e81fee1dc7de7683f3e1ffe0bfd8a573d"}, ] -[[package]] -name = "pathspec" -version = "0.11.2" -description = "Utility library for gitignore style pattern matching of file paths." -optional = false -python-versions = ">=3.7" -files = [ - {file = "pathspec-0.11.2-py3-none-any.whl", hash = "sha256:1d6ed233af05e679efb96b1851550ea95bbb64b7c490b0f5aa52996c11e92a20"}, - {file = "pathspec-0.11.2.tar.gz", hash = "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3"}, -] - [[package]] name = "pdoc" version = "14.1.0" @@ -2068,28 +2017,28 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "ruff" -version = "0.1.4" +version = "0.1.5" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.1.4-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:864958706b669cce31d629902175138ad8a069d99ca53514611521f532d91495"}, - {file = "ruff-0.1.4-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:9fdd61883bb34317c788af87f4cd75dfee3a73f5ded714b77ba928e418d6e39e"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b4eaca8c9cc39aa7f0f0d7b8fe24ecb51232d1bb620fc4441a61161be4a17539"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a9a1301dc43cbf633fb603242bccd0aaa34834750a14a4c1817e2e5c8d60de17"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:78e8db8ab6f100f02e28b3d713270c857d370b8d61871d5c7d1702ae411df683"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:80fea754eaae06335784b8ea053d6eb8e9aac75359ebddd6fee0858e87c8d510"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6bc02a480d4bfffd163a723698da15d1a9aec2fced4c06f2a753f87f4ce6969c"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9862811b403063765b03e716dac0fda8fdbe78b675cd947ed5873506448acea4"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:58826efb8b3efbb59bb306f4b19640b7e366967a31c049d49311d9eb3a4c60cb"}, - {file = "ruff-0.1.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:fdfd453fc91d9d86d6aaa33b1bafa69d114cf7421057868f0b79104079d3e66e"}, - {file = "ruff-0.1.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:e8791482d508bd0b36c76481ad3117987301b86072158bdb69d796503e1c84a8"}, - {file = "ruff-0.1.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:01206e361021426e3c1b7fba06ddcb20dbc5037d64f6841e5f2b21084dc51800"}, - {file = "ruff-0.1.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:645591a613a42cb7e5c2b667cbefd3877b21e0252b59272ba7212c3d35a5819f"}, - {file = "ruff-0.1.4-py3-none-win32.whl", hash = "sha256:99908ca2b3b85bffe7e1414275d004917d1e0dfc99d497ccd2ecd19ad115fd0d"}, - {file = "ruff-0.1.4-py3-none-win_amd64.whl", hash = "sha256:1dfd6bf8f6ad0a4ac99333f437e0ec168989adc5d837ecd38ddb2cc4a2e3db8a"}, - {file = "ruff-0.1.4-py3-none-win_arm64.whl", hash = "sha256:d98ae9ebf56444e18a3e3652b3383204748f73e247dea6caaf8b52d37e6b32da"}, - {file = "ruff-0.1.4.tar.gz", hash = "sha256:21520ecca4cc555162068d87c747b8f95e1e95f8ecfcbbe59e8dd00710586315"}, + {file = "ruff-0.1.5-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:32d47fc69261c21a4c48916f16ca272bf2f273eb635d91c65d5cd548bf1f3d96"}, + {file = "ruff-0.1.5-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:171276c1df6c07fa0597fb946139ced1c2978f4f0b8254f201281729981f3c17"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:17ef33cd0bb7316ca65649fc748acc1406dfa4da96a3d0cde6d52f2e866c7b39"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b2c205827b3f8c13b4a432e9585750b93fd907986fe1aec62b2a02cf4401eee6"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bb408e3a2ad8f6881d0f2e7ad70cddb3ed9f200eb3517a91a245bbe27101d379"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:f20dc5e5905ddb407060ca27267c7174f532375c08076d1a953cf7bb016f5a24"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:aafb9d2b671ed934998e881e2c0f5845a4295e84e719359c71c39a5363cccc91"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a4894dddb476597a0ba4473d72a23151b8b3b0b5f958f2cf4d3f1c572cdb7af7"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a00a7ec893f665ed60008c70fe9eeb58d210e6b4d83ec6654a9904871f982a2a"}, + {file = "ruff-0.1.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:a8c11206b47f283cbda399a654fd0178d7a389e631f19f51da15cbe631480c5b"}, + {file = "ruff-0.1.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:fa29e67b3284b9a79b1a85ee66e293a94ac6b7bb068b307a8a373c3d343aa8ec"}, + {file = "ruff-0.1.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9b97fd6da44d6cceb188147b68db69a5741fbc736465b5cea3928fdac0bc1aeb"}, + {file = "ruff-0.1.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:721f4b9d3b4161df8dc9f09aa8562e39d14e55a4dbaa451a8e55bdc9590e20f4"}, + {file = "ruff-0.1.5-py3-none-win32.whl", hash = "sha256:f80c73bba6bc69e4fdc73b3991db0b546ce641bdcd5b07210b8ad6f64c79f1ab"}, + {file = "ruff-0.1.5-py3-none-win_amd64.whl", hash = "sha256:c21fe20ee7d76206d290a76271c1af7a5096bc4c73ab9383ed2ad35f852a0087"}, + {file = "ruff-0.1.5-py3-none-win_arm64.whl", hash = "sha256:82bfcb9927e88c1ed50f49ac6c9728dab3ea451212693fe40d08d314663e412f"}, + {file = "ruff-0.1.5.tar.gz", hash = "sha256:5cbec0ef2ae1748fb194f420fb03fb2c25c3258c86129af7172ff8f198f125ab"}, ] [[package]] @@ -2554,4 +2503,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = ">=3.11,<3.13" -content-hash = "685c148f5d6a1b2d8d0b1d84dfd2dae370076f3cef8ff5abdaa68164c3c4405e" +content-hash = "1e1e703b7252fefa136ef205d3d3fcce0344b04bf8cdf6146bdce3448522b15b" diff --git a/pyproject.toml b/pyproject.toml index e1cbe119..da6004e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,22 +46,18 @@ pytest-xdist = "^3.3.1" [tool.poetry.group.dev.dependencies] - black = "^23.11.0" commitizen = "^3.12.0" coverage = "^7.3.2" mypy = "^1.6.1" pdoc = "^14.0.0" poethepoet = "^0.22.1" pre-commit = "^3.5.0" - ruff = "^0.1.4" + ruff = "^0.1.5" shellcheck-py = "^0.9.0.5" types-aiofiles = "^23.2.0.0" typos = "^1.16.23" vulture = "^2.10" -[tool.black] - line-length = 100 - [tool.commitizen] bump_message = "bump(release): v$current_version → v$new_version" changelog_merge_prerelease = true @@ -192,6 +188,7 @@ "D413", "E266", "E501", + "ISC001", "N805", "PGH001", "PGH003", @@ -329,7 +326,7 @@ shell = "ruff --preview --no-fix src/" [[tool.poe.tasks.lint.sequence]] - shell = "black --check src/ tests/" + shell = "ruff format --check src/ tests/" [[tool.poe.tasks.lint.sequence]] shell = "poetry check" diff --git a/src/valentina/__version__.py b/src/valentina/__version__.py index 15869050..88f8c5b4 100644 --- a/src/valentina/__version__.py +++ b/src/valentina/__version__.py @@ -1,2 +1,3 @@ """Valentina version.""" + __version__ = "2.0.0" diff --git a/src/valentina/characters/__init__.py b/src/valentina/characters/__init__.py index 1d3a7379..67f15488 100644 --- a/src/valentina/characters/__init__.py +++ b/src/valentina/characters/__init__.py @@ -1,4 +1,5 @@ """Models for working with characters.""" + from .add_from_sheet import AddFromSheetWizard from .chargen import CharGenWizard, RNGCharGen from .reallocate_dots import DotsReallocationWizard diff --git a/src/valentina/characters/add_from_sheet.py b/src/valentina/characters/add_from_sheet.py index 72264d67..81b9d847 100644 --- a/src/valentina/characters/add_from_sheet.py +++ b/src/valentina/characters/add_from_sheet.py @@ -1,4 +1,5 @@ """A wizard that walks the user through the character creation process.""" + import asyncio import uuid from typing import Any diff --git a/src/valentina/characters/buttons.py b/src/valentina/characters/buttons.py index baaa979a..a9974c16 100644 --- a/src/valentina/characters/buttons.py +++ b/src/valentina/characters/buttons.py @@ -1,4 +1,5 @@ """Buttons for character creation.""" + from typing import cast import discord diff --git a/src/valentina/characters/chargen.py b/src/valentina/characters/chargen.py index 2f30f512..cbe8c2d7 100644 --- a/src/valentina/characters/chargen.py +++ b/src/valentina/characters/chargen.py @@ -1,4 +1,5 @@ """A RNG character generator for Valentina.""" + import random from typing import Literal, cast @@ -94,7 +95,9 @@ def _disable_all(self) -> None: row=2, ) async def reroll_callback( - self, button: Button, interaction: discord.Interaction # noqa: ARG002 + self, + button: Button, # noqa: ARG002 + interaction: discord.Interaction, ) -> None: """Disable all buttons and stop the view.""" await interaction.response.defer() @@ -109,7 +112,9 @@ async def reroll_callback( row=2, ) async def cancel_callback( - self, button: Button, interaction: discord.Interaction # noqa: ARG002 + self, + button: Button, # noqa: ARG002 + interaction: discord.Interaction, ) -> None: """Disable all buttons and stop the view.""" await interaction.response.defer() @@ -220,7 +225,9 @@ def _disable_all(self) -> None: row=2, ) async def rename_callback( - self, button: Button, interaction: discord.Interaction # noqa: ARG002 + self, + button: Button, # noqa: ARG002 + interaction: discord.Interaction, ) -> None: """Callback for the rename button.""" self._disable_all() @@ -240,7 +247,9 @@ async def rename_callback( row=2, ) async def reallocate_callback( - self, button: Button, interaction: discord.Interaction # noqa: ARG002 + self, + button: Button, # noqa: ARG002 + interaction: discord.Interaction, ) -> None: """Callback for the reallocate button.""" await interaction.response.defer() diff --git a/src/valentina/characters/reallocate_dots.py b/src/valentina/characters/reallocate_dots.py index d9039b35..1718e496 100644 --- a/src/valentina/characters/reallocate_dots.py +++ b/src/valentina/characters/reallocate_dots.py @@ -1,4 +1,5 @@ """A wizard that walks the user through the character creation process.""" + from typing import cast import discord diff --git a/src/valentina/cogs/admin.py b/src/valentina/cogs/admin.py index 86b0c181..d1b421fd 100644 --- a/src/valentina/cogs/admin.py +++ b/src/valentina/cogs/admin.py @@ -1,5 +1,6 @@ # mypy: disable-error-code="valid-type" """Administration commands for Valentina.""" + from pathlib import Path import discord @@ -216,7 +217,8 @@ async def massban( await assert_permissions(ctx, ban_members=True) converter = MemberConverter() converted_members = [ - await converter.convert(ctx, member) for member in members.split() # type: ignore # mismatching context type + await converter.convert(ctx, member) # type: ignore # mismatching context type + for member in members.split() ] if (count := len(converted_members)) > 10: # noqa: PLR2004 await present_embed( diff --git a/src/valentina/cogs/characters.py b/src/valentina/cogs/characters.py index 1e1c9bd7..6392b793 100644 --- a/src/valentina/cogs/characters.py +++ b/src/valentina/cogs/characters.py @@ -1,5 +1,6 @@ # mypy: disable-error-code="valid-type" """Character cog for Valentina.""" + from pathlib import Path import discord @@ -234,7 +235,8 @@ async def list_characters( ) -> None: """List all player characters in this guild.""" all_characters = await Character.find_many( - Character.guild == ctx.guild.id, Character.type_player == True # noqa: E712 + Character.guild == ctx.guild.id, + Character.type_player == True, # noqa: E712 ).to_list() if scope == "mine": diff --git a/src/valentina/cogs/developer.py b/src/valentina/cogs/developer.py index 489aa9b4..025d68a9 100644 --- a/src/valentina/cogs/developer.py +++ b/src/valentina/cogs/developer.py @@ -1,5 +1,6 @@ # mypy: disable-error-code="valid-type" """Commands for bot development.""" + from datetime import datetime from pathlib import Path @@ -183,7 +184,8 @@ async def delete_developer_characters( ) -> None: """Delete all developer characters from the database.""" dev_characters = await Character.find( - Character.type_developer == True, fetch_links=True # noqa: E712 + Character.type_developer == True, # noqa: E712 + fetch_links=True, ).to_list() title = f"Delete `{len(dev_characters)}` developer {p.plural_noun('character', len(dev_characters))} characters from `{ctx.guild.name}`" diff --git a/src/valentina/cogs/experience.py b/src/valentina/cogs/experience.py index bc0b5750..497baf69 100644 --- a/src/valentina/cogs/experience.py +++ b/src/valentina/cogs/experience.py @@ -1,5 +1,6 @@ # mypy: disable-error-code="valid-type" """Experience commands.""" + import discord import inflect from discord.commands import Option diff --git a/src/valentina/cogs/help.py b/src/valentina/cogs/help.py index 530740ef..b17ff5a1 100644 --- a/src/valentina/cogs/help.py +++ b/src/valentina/cogs/help.py @@ -1,5 +1,6 @@ # mypy: disable-error-code="valid-type" """Help Command for Valentina.""" + from pathlib import Path import discord @@ -73,7 +74,9 @@ def __build_help_text(self, cmd: commands.Command) -> str: @help.command(name="commands", description="Help information for Valentina's commands") async def command_help( - self, ctx: ValentinaContext, command: Option(str, required=False) # type: ignore + self, + ctx: ValentinaContext, + command: Option(str, required=False), # type: ignore ) -> None: """Provide help information.""" commands = self.__build_command_list(ctx) diff --git a/src/valentina/cogs/misc.py b/src/valentina/cogs/misc.py index 96cd518e..480068ed 100644 --- a/src/valentina/cogs/misc.py +++ b/src/valentina/cogs/misc.py @@ -1,5 +1,6 @@ # mypy: disable-error-code="valid-type" """Miscellaneous commands.""" + import random import arrow @@ -102,7 +103,9 @@ async def server_info( embed.add_field( name="Roll Statistics", value=await roll_stats.guild_statistics( - as_embed=False, with_title=False, with_help=True # type: ignore [arg-type] + as_embed=False, + with_title=False, + with_help=True, # type: ignore [arg-type] ), inline=False, ) diff --git a/src/valentina/main.py b/src/valentina/main.py index 58318f60..9ed09a93 100644 --- a/src/valentina/main.py +++ b/src/valentina/main.py @@ -1,4 +1,5 @@ """Main file which instantiates the bot and runs it.""" + import logging import os import sys diff --git a/src/valentina/models/aws.py b/src/valentina/models/aws.py index c2c10c38..7f04d84b 100644 --- a/src/valentina/models/aws.py +++ b/src/valentina/models/aws.py @@ -1,4 +1,5 @@ """Class for interacting with AWS services.""" + from pathlib import Path import boto3 diff --git a/src/valentina/models/character.py b/src/valentina/models/character.py index 3be871d2..8379993c 100644 --- a/src/valentina/models/character.py +++ b/src/valentina/models/character.py @@ -1,4 +1,5 @@ """Character models for Valentina.""" + from datetime import datetime from typing import Optional, Union, cast diff --git a/src/valentina/models/errors.py b/src/valentina/models/errors.py index 141f4ffb..f30c3e43 100644 --- a/src/valentina/models/errors.py +++ b/src/valentina/models/errors.py @@ -1,4 +1,5 @@ """Model for error handling.""" + import traceback import discord @@ -134,7 +135,9 @@ async def report_error(self, ctx: discord.ApplicationContext, error: Exception) except discord.HTTPException: await respond( embed=user_error_embed( - ctx, "Message too long to send", "This is a bug has been reported" # type: ignore [arg-type] + ctx, # type: ignore [arg-type] + "Message too long to send", + "This is a bug has been reported", ), ephemeral=True, delete_after=15, diff --git a/src/valentina/models/guild.py b/src/valentina/models/guild.py index 8ef9763a..097f1b52 100644 --- a/src/valentina/models/guild.py +++ b/src/valentina/models/guild.py @@ -1,4 +1,5 @@ """Guild models for Valentina.""" + import random from datetime import datetime diff --git a/src/valentina/models/probability.py b/src/valentina/models/probability.py index 557cf098..2b78cc94 100644 --- a/src/valentina/models/probability.py +++ b/src/valentina/models/probability.py @@ -1,4 +1,5 @@ """Utilities for diceroll probability calculations.""" + from collections import defaultdict from datetime import datetime diff --git a/src/valentina/models/user.py b/src/valentina/models/user.py index 37613025..45030ce0 100644 --- a/src/valentina/models/user.py +++ b/src/valentina/models/user.py @@ -1,4 +1,5 @@ """User models for Valentina.""" + from datetime import datetime from typing import cast diff --git a/src/valentina/utils/changelog_parser.py b/src/valentina/utils/changelog_parser.py index 4ef5ef67..ea366e08 100644 --- a/src/valentina/utils/changelog_parser.py +++ b/src/valentina/utils/changelog_parser.py @@ -1,4 +1,5 @@ """Helper class for parsing changelogs.""" + import random import re diff --git a/src/valentina/utils/converters.py b/src/valentina/utils/converters.py index 561d40d3..ffdc3b96 100644 --- a/src/valentina/utils/converters.py +++ b/src/valentina/utils/converters.py @@ -72,7 +72,9 @@ class ValidCharacterConcept(Converter): """Convert a CharacterConcept name to a CharacterConcept enum.""" async def convert( - self, ctx: commands.Context, argument: str # noqa: ARG002 + self, + ctx: commands.Context, # noqa: ARG002 + argument: str, ) -> CharacterConcept: """Validate and normalize character concepts.""" try: diff --git a/src/valentina/utils/discord_utils.py b/src/valentina/utils/discord_utils.py index a46dd392..13149c4e 100644 --- a/src/valentina/utils/discord_utils.py +++ b/src/valentina/utils/discord_utils.py @@ -1,4 +1,5 @@ """Helper utilities for working with the discord API.""" + import discord from loguru import logger diff --git a/src/valentina/utils/errors.py b/src/valentina/utils/errors.py index bbefa7b8..9a1eb8c7 100644 --- a/src/valentina/utils/errors.py +++ b/src/valentina/utils/errors.py @@ -1,4 +1,5 @@ """Custom error types for Valentina.""" + from discord import DiscordException diff --git a/src/valentina/utils/helpers.py b/src/valentina/utils/helpers.py index ec4d4e06..0d99d368 100644 --- a/src/valentina/utils/helpers.py +++ b/src/valentina/utils/helpers.py @@ -1,4 +1,5 @@ """Helper functions for Valentina.""" + import io import random from datetime import datetime, timezone diff --git a/src/valentina/utils/logging.py b/src/valentina/utils/logging.py index f591952d..f1eee950 100644 --- a/src/valentina/utils/logging.py +++ b/src/valentina/utils/logging.py @@ -1,4 +1,5 @@ """Logging utilities for Valentina.""" + import logging import sys diff --git a/src/valentina/utils/types.py b/src/valentina/utils/types.py index fff687fd..3e7be1f3 100644 --- a/src/valentina/utils/types.py +++ b/src/valentina/utils/types.py @@ -1,5 +1,6 @@ # mypy: disable-error-code="name-defined" """Custom Types for Valentina.""" + from typing import TypedDict diff --git a/src/valentina/views/actions.py b/src/valentina/views/actions.py index 9b985a41..25cb4e74 100644 --- a/src/valentina/views/actions.py +++ b/src/valentina/views/actions.py @@ -1,4 +1,5 @@ """Combinations of views and embeds for common actions.""" + from collections.abc import Coroutine import discord @@ -60,13 +61,13 @@ async def confirm_action( title=title.rstrip("?"), description=description, color=EmbedColor.SUCCESS.value ) if image is not None: - response_embed.set_image(url=image), + (response_embed.set_image(url=image),) if thumbnail is not None: - response_embed.set_thumbnail(url=thumbnail), + (response_embed.set_thumbnail(url=thumbnail),) if footer is not None: - response_embed.set_footer(text=footer), + (response_embed.set_footer(text=footer),) if delete_after_confirmation: response = msg.delete_original_response() diff --git a/src/valentina/views/buttons.py b/src/valentina/views/buttons.py index 6b25f9fb..4e784379 100644 --- a/src/valentina/views/buttons.py +++ b/src/valentina/views/buttons.py @@ -1,4 +1,5 @@ """Buttons and views for Valentina.""" + import discord from discord.ui import Button @@ -184,7 +185,9 @@ def _disable_all(self) -> None: custom_id="cancel", ) async def cancel_callback( - self, button: Button, interaction: discord.Interaction # noqa: ARG002 + self, + button: Button, # noqa: ARG002 + interaction: discord.Interaction, ) -> None: """Callback for the cancel button.""" self._disable_all() diff --git a/src/valentina/views/character_sheet.py b/src/valentina/views/character_sheet.py index e4885dd4..abf8d24a 100644 --- a/src/valentina/views/character_sheet.py +++ b/src/valentina/views/character_sheet.py @@ -1,4 +1,5 @@ """View a character sheet.""" + from typing import Any, cast import arrow diff --git a/src/valentina/views/embeds.py b/src/valentina/views/embeds.py index 4da63658..529aa27f 100644 --- a/src/valentina/views/embeds.py +++ b/src/valentina/views/embeds.py @@ -1,4 +1,5 @@ """Prebuilt embeds for Valentina.""" + import traceback from datetime import datetime from typing import Any diff --git a/src/valentina/views/modals.py b/src/valentina/views/modals.py index 16af287e..300d5c1b 100644 --- a/src/valentina/views/modals.py +++ b/src/valentina/views/modals.py @@ -1,4 +1,5 @@ """Modal windows for the application.""" + import discord from discord.ui import InputText, Modal @@ -168,7 +169,13 @@ async def callback(self, interaction: discord.Interaction) -> None: class CustomSectionModal(Modal): """A modal for adding or editing a custom section.""" - def __init__(self, section_title: str | None = None, section_content: str | None = None, *args, **kwargs) -> None: # type: ignore [no-untyped-def] + def __init__( # type: ignore [no-untyped-def] + self, + section_title: str | None = None, + section_content: str | None = None, + *args, + **kwargs, + ) -> None: super().__init__(*args, **kwargs) self.section_title = section_title self.section_content = section_content diff --git a/src/valentina/views/roll_display.py b/src/valentina/views/roll_display.py index 5ac39db7..09485650 100644 --- a/src/valentina/views/roll_display.py +++ b/src/valentina/views/roll_display.py @@ -1,4 +1,5 @@ """Display and manipulate roll outcomes.""" + import discord import inflect diff --git a/src/valentina/views/s3_image_review.py b/src/valentina/views/s3_image_review.py index 99861569..8481ae2a 100644 --- a/src/valentina/views/s3_image_review.py +++ b/src/valentina/views/s3_image_review.py @@ -63,7 +63,9 @@ async def confirm_callback(self, button: Button, interaction: discord.Interactio row=1, ) async def done_callback( - self, button: Button, interaction: discord.Interaction # noqa: ARG002 + self, + button: Button, # noqa: ARG002 + interaction: discord.Interaction, ) -> None: """Callback for the re-roll button.""" await interaction.response.edit_message( diff --git a/src/valentina/views/settings.py b/src/valentina/views/settings.py index c911803b..2f762353 100644 --- a/src/valentina/views/settings.py +++ b/src/valentina/views/settings.py @@ -1,4 +1,5 @@ """Views for configuring guild settings.""" + from typing import cast import discord @@ -70,7 +71,9 @@ def __init__( custom_id="cancel", ) async def cancel_callback( - self, button: Button, interaction: discord.Interaction # noqa: ARG002 + self, + button: Button, # noqa: ARG002 + interaction: discord.Interaction, ) -> None: """Disable all buttons and stop the view.""" for child in self.children: @@ -219,7 +222,9 @@ async def channel_select_dropdown( custom_id="disable", ) async def disable_callback( - self, button: Button, interaction: discord.Interaction # noqa: ARG002 + self, + button: Button, # noqa: ARG002 + interaction: discord.Interaction, ) -> None: """Disable all buttons and stop the view.""" for child in self.children: @@ -242,7 +247,9 @@ async def disable_callback( custom_id="cancel", ) async def cancel_callback( - self, button: Button, interaction: discord.Interaction # noqa: ARG002 + self, + button: Button, # noqa: ARG002 + interaction: discord.Interaction, ) -> None: """Disable all buttons and stop the view.""" for child in self.children: diff --git a/src/valentina/views/thumbnail_review.py b/src/valentina/views/thumbnail_review.py index bca936d3..7e564ae6 100644 --- a/src/valentina/views/thumbnail_review.py +++ b/src/valentina/views/thumbnail_review.py @@ -64,7 +64,9 @@ async def confirm_callback(self, button: Button, interaction: discord.Interactio row=1, ) async def done_callback( - self, button: Button, interaction: discord.Interaction # noqa: ARG002 + self, + button: Button, # noqa: ARG002 + interaction: discord.Interaction, ) -> None: """Callback for the re-roll button.""" await interaction.response.edit_message( diff --git a/tests/factories.py b/tests/factories.py index e5806289..2119a8ca 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -5,6 +5,7 @@ Read more at https://polyfactory.litestar.dev/latest/index.html """ + from faker import Faker from polyfactory.factories.beanie_odm_factory import BeanieDocumentFactory from polyfactory.pytest_plugin import register_fixture diff --git a/tests/helpers.py b/tests/helpers.py index c200cdf7..f248ef84 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -1,5 +1,6 @@ # type: ignore """Helper utilities for tests.""" + import re diff --git a/tests/test_aws_service.py b/tests/test_aws_service.py index 0fc370c3..c7f298f6 100644 --- a/tests/test_aws_service.py +++ b/tests/test_aws_service.py @@ -1,5 +1,6 @@ # type: ignore """Tests for the AWS service.""" + from unittest.mock import AsyncMock, MagicMock import pytest diff --git a/tests/test_constants.py b/tests/test_constants.py index 4ee17672..31392668 100644 --- a/tests/test_constants.py +++ b/tests/test_constants.py @@ -1,5 +1,6 @@ # type: ignore """Test the constants module.""" + import pytest from valentina.constants import ( diff --git a/tests/test_converters.py b/tests/test_converters.py index ab5ab969..6a854cef 100644 --- a/tests/test_converters.py +++ b/tests/test_converters.py @@ -1,5 +1,6 @@ # type: ignore """Tests for the converters module.""" + import datetime import pytest diff --git a/tests/test_dicerolls.py b/tests/test_dicerolls.py index 9ee11a51..a9f25c27 100644 --- a/tests/test_dicerolls.py +++ b/tests/test_dicerolls.py @@ -1,5 +1,6 @@ # type: ignore """Tests for the dicerolls module.""" + import pytest from valentina.constants import RollResultType diff --git a/tests/test_discord_utils.py b/tests/test_discord_utils.py index 84862a9d..692d4e64 100644 --- a/tests/test_discord_utils.py +++ b/tests/test_discord_utils.py @@ -1,5 +1,6 @@ # type: ignore """Tests for discord_utils.py helper utilities.""" + from unittest.mock import MagicMock, patch import pytest diff --git a/tests/test_guild_model.py b/tests/test_guild_model.py index 9de1ba21..f1b4c9a4 100644 --- a/tests/test_guild_model.py +++ b/tests/test_guild_model.py @@ -1,5 +1,6 @@ # type: ignore """Test the Guild database model.""" + import pytest from rich import print diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 45f42877..a49c4fb3 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -1,5 +1,6 @@ # type: ignore """Tests for helper utilities.""" + import pytest from valentina.utils.helpers import adjust_sum_to_match_total, divide_into_three, num_to_circles diff --git a/tests/test_probability.py b/tests/test_probability.py index cceff954..85c7707e 100644 --- a/tests/test_probability.py +++ b/tests/test_probability.py @@ -1,5 +1,6 @@ # type: ignore """Tests for the probability module.""" + import re import discord @@ -23,7 +24,7 @@ async def test_calculate_no_db(mock_ctx1): assert result.pool == 5 assert result.difficulty == 6 assert result.dice_size == 10 - assert round(result.total_results) in range(195, 210) + assert round(result.total_results) in range(190, 210) assert round(result.botch_dice) in range(5, 15) assert round(result.success_dice) in range(35, 45) assert round(result.failure_dice) in range(35, 45)