diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b374efb6..9fec49ee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,13 +8,13 @@ repos: - id: detect-discord-bot-tokens - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.21.2 hooks: - id: pyupgrade args: ["--py310-plus"] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v6.0.0 hooks: - id: check-ast - id: check-builtin-literals @@ -47,24 +47,24 @@ repos: - id: python-use-type-annotations - id: text-unicode-replacement-char - - repo: https://github.com/psf/black - rev: 23.1.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.10.0 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 9.0.2 hooks: - id: isort - repo: https://github.com/PyCQA/autoflake - rev: v2.0.1 + rev: v2.4.0 hooks: - id: autoflake args: ["-i", "--remove-all-unused-imports", "--remove-unused-variables"] - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 7.4.1 hooks: - id: flake8 args: ["--ignore=E203,W503", "--max-line-length=88"] @@ -76,31 +76,31 @@ repos: additional_dependencies: ["tomli"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.991 + rev: v2.4.0 hooks: - id: mypy args: ["--ignore-missing-imports", "--show-error-codes"] - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.4 + rev: v4.0.0-alpha.8 hooks: - id: prettier args: ["--print-width=88", "--prose-wrap=always"] exclude: ^docs/internal/[a-z-]+\.md$ - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.4.2 + rev: v1.5.6 hooks: - id: remove-tabs - repo: https://github.com/sirosen/texthooks - rev: 0.5.0 + rev: 0.7.1 hooks: - id: fix-smartquotes - id: fix-spaces - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.21.0 + rev: 0.38.2 hooks: - id: check-github-workflows - id: check-renovate diff --git a/botstrap/__main__.py b/botstrap/__main__.py index c80cc060..04da58a6 100644 --- a/botstrap/__main__.py +++ b/botstrap/__main__.py @@ -1,4 +1,5 @@ """This module is an entry point for Botstrap's standalone CLI: `python -m botstrap`.""" + from __future__ import annotations from botstrap import cli diff --git a/botstrap/cli/init.py b/botstrap/cli/init.py index ac0a9d33..98bd6b25 100644 --- a/botstrap/cli/init.py +++ b/botstrap/cli/init.py @@ -1,4 +1,5 @@ """This module contains functions used by the `botstrap init` standalone CLI command.""" + from __future__ import annotations import re diff --git a/botstrap/cli/menu.py b/botstrap/cli/menu.py index c0e61421..bcc3fc32 100644 --- a/botstrap/cli/menu.py +++ b/botstrap/cli/menu.py @@ -1,4 +1,5 @@ """This module contains the entry point and main menu for Botstrap's standalone CLI.""" + from __future__ import annotations import functools diff --git a/botstrap/cli/scan.py b/botstrap/cli/scan.py index d4f352e4..d3ece654 100644 --- a/botstrap/cli/scan.py +++ b/botstrap/cli/scan.py @@ -1,4 +1,5 @@ """This module contains functions used by the `botstrap scan` standalone CLI command.""" + from __future__ import annotations import os diff --git a/botstrap/cli/utils.py b/botstrap/cli/utils.py index e736c985..fe7236ac 100644 --- a/botstrap/cli/utils.py +++ b/botstrap/cli/utils.py @@ -1,4 +1,5 @@ """This module contains general utility functions for the `botstrap` standalone CLI.""" + from __future__ import annotations import re diff --git a/botstrap/colors.py b/botstrap/colors.py index 6da61877..0e883205 100644 --- a/botstrap/colors.py +++ b/botstrap/colors.py @@ -1,4 +1,5 @@ """This module contains `Color` & `CliColors`, both of which add color to CLI output.""" + from __future__ import annotations from collections.abc import Callable diff --git a/botstrap/flow.py b/botstrap/flow.py index b0588044..5f30d15b 100644 --- a/botstrap/flow.py +++ b/botstrap/flow.py @@ -1,4 +1,5 @@ """This module features the `Botstrap` class, which is the primary integration point.""" + from __future__ import annotations from pathlib import Path diff --git a/botstrap/internal/argstrap.py b/botstrap/internal/argstrap.py index b5ec1d9b..1b9fcadc 100644 --- a/botstrap/internal/argstrap.py +++ b/botstrap/internal/argstrap.py @@ -1,4 +1,5 @@ """This module contains the `Argstrap` class, which parses arguments for a bot's CLI.""" + from __future__ import annotations import argparse diff --git a/botstrap/internal/clisession.py b/botstrap/internal/clisession.py index 7aa5a9ec..84532db5 100644 --- a/botstrap/internal/clisession.py +++ b/botstrap/internal/clisession.py @@ -1,4 +1,5 @@ """This module contains the `CliSession` class, which facilitates command-line I/O.""" + from __future__ import annotations from collections.abc import Callable diff --git a/botstrap/internal/metadata.py b/botstrap/internal/metadata.py index 295da10a..696db4f9 100644 --- a/botstrap/internal/metadata.py +++ b/botstrap/internal/metadata.py @@ -1,4 +1,5 @@ """This module contains the `Metadata` class, which provides metadata-related utils.""" + from __future__ import annotations import sys diff --git a/botstrap/internal/secrets.py b/botstrap/internal/secrets.py index 2cb6f960..acacfa97 100644 --- a/botstrap/internal/secrets.py +++ b/botstrap/internal/secrets.py @@ -1,4 +1,5 @@ """This module contains the `Secret` class, which encrypts and decrypts data files.""" + from __future__ import annotations import os @@ -120,7 +121,7 @@ def _get_storage_dir(storage_directory: str | Path | None) -> Path: @staticmethod def _get_validator( - valid_pattern: str | re.Pattern | Callable[[str], Any] | None + valid_pattern: str | re.Pattern | Callable[[str], Any] | None, ) -> Callable[[str], bool]: """Turns `valid_pattern` into a function that takes a str and returns a bool.""" if not valid_pattern: diff --git a/botstrap/internal/tokens.py b/botstrap/internal/tokens.py index 6b42f5d2..a1209ecc 100644 --- a/botstrap/internal/tokens.py +++ b/botstrap/internal/tokens.py @@ -1,4 +1,5 @@ """This module contains the `Token` class, which represents a Discord bot token.""" + from __future__ import annotations import re diff --git a/botstrap/options.py b/botstrap/options.py index 197980a7..f5678cc4 100644 --- a/botstrap/options.py +++ b/botstrap/options.py @@ -1,4 +1,5 @@ """This module contains the `Option` class, which is a model for custom CLI options.""" + from __future__ import annotations import argparse diff --git a/botstrap/strings.py b/botstrap/strings.py index cb53ba8d..4ee27ff5 100644 --- a/botstrap/strings.py +++ b/botstrap/strings.py @@ -1,4 +1,5 @@ """This module contains the `CliStrings` class, which defines text shown in the CLI.""" + from __future__ import annotations from collections.abc import Callable, Iterable @@ -306,18 +307,15 @@ def get_affirmation_prompt( @overload -def _get_compact_value(value: str) -> str: - ... +def _get_compact_value(value: str) -> str: ... @overload -def _get_compact_value(value: Template) -> Template: - ... +def _get_compact_value(value: Template) -> Template: ... @overload -def _get_compact_value(value: tuple[str]) -> tuple[str, ...]: - ... +def _get_compact_value(value: tuple[str]) -> tuple[str, ...]: ... def _get_compact_value(value: Any) -> str | Template | tuple[str, ...]: diff --git a/docs/stylesheets/getting-started.css b/docs/stylesheets/getting-started.css index 77e548cb..ca4cbff0 100644 --- a/docs/stylesheets/getting-started.css +++ b/docs/stylesheets/getting-started.css @@ -1,6 +1,5 @@ /** Adjust the vertical alignment of inline badge images from shields.io. */ -img[src^="https://img.shields.io/"] -{ +img[src^="https://img.shields.io/"] { margin-top: -0.125em; vertical-align: text-top; } diff --git a/docs/stylesheets/material.css b/docs/stylesheets/material.css index 59123b44..6a5713b6 100644 --- a/docs/stylesheets/material.css +++ b/docs/stylesheets/material.css @@ -69,7 +69,9 @@ display: block; margin: 0; padding: 0.8rem; - transition: border 0.25s, box-shadow 0.25s; + transition: + border 0.25s, + box-shadow 0.25s; } .md-typeset .grid.cards > :is(ul, ol) > li:is(:focus-within, :hover), diff --git a/examples/examplebot/__main__.py b/examples/examplebot/__main__.py index 1e0622ef..f7ab64dd 100644 --- a/examples/examplebot/__main__.py +++ b/examples/examplebot/__main__.py @@ -2,7 +2,6 @@ from discord import Activity, ActivityType, AllowedMentions from examplebot.extras import AlphaBot, initialize_system_logging - botstrap = ( Botstrap( name="examplebot", diff --git a/tests/botstrap/cli/test_init.py b/tests/botstrap/cli/test_init.py index 643d26e6..16413214 100644 --- a/tests/botstrap/cli/test_init.py +++ b/tests/botstrap/cli/test_init.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.cli.init` module.""" + from __future__ import annotations import functools diff --git a/tests/botstrap/cli/test_menu.py b/tests/botstrap/cli/test_menu.py index ec0224c4..2acf93fb 100644 --- a/tests/botstrap/cli/test_menu.py +++ b/tests/botstrap/cli/test_menu.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.cli.menu` module.""" + from __future__ import annotations import re diff --git a/tests/botstrap/cli/test_scan.py b/tests/botstrap/cli/test_scan.py index 1874d642..eb6c2e2e 100644 --- a/tests/botstrap/cli/test_scan.py +++ b/tests/botstrap/cli/test_scan.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.cli.scan` module.""" + from __future__ import annotations import re diff --git a/tests/botstrap/cli/test_utils.py b/tests/botstrap/cli/test_utils.py index 508fb8d3..0bbf2b6e 100644 --- a/tests/botstrap/cli/test_utils.py +++ b/tests/botstrap/cli/test_utils.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.cli.utils` module.""" + from __future__ import annotations import re diff --git a/tests/botstrap/internal/test_argstrap.py b/tests/botstrap/internal/test_argstrap.py index 5c2ab8dd..291a37d5 100644 --- a/tests/botstrap/internal/test_argstrap.py +++ b/tests/botstrap/internal/test_argstrap.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.internal.argstrap` module.""" + from __future__ import annotations import re diff --git a/tests/botstrap/internal/test_clisession.py b/tests/botstrap/internal/test_clisession.py index aadb1766..445a6865 100644 --- a/tests/botstrap/internal/test_clisession.py +++ b/tests/botstrap/internal/test_clisession.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.internal.clisession` module.""" + from __future__ import annotations from collections.abc import Callable diff --git a/tests/botstrap/internal/test_metadata.py b/tests/botstrap/internal/test_metadata.py index b46070e3..3e3f70c9 100644 --- a/tests/botstrap/internal/test_metadata.py +++ b/tests/botstrap/internal/test_metadata.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.internal.metadata` module.""" + from __future__ import annotations import sys diff --git a/tests/botstrap/internal/test_secrets.py b/tests/botstrap/internal/test_secrets.py index cf24449b..9e7dc3a5 100644 --- a/tests/botstrap/internal/test_secrets.py +++ b/tests/botstrap/internal/test_secrets.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.internal.secrets` module.""" + from __future__ import annotations import re diff --git a/tests/botstrap/internal/test_tokens.py b/tests/botstrap/internal/test_tokens.py index 5b43274a..f114e369 100644 --- a/tests/botstrap/internal/test_tokens.py +++ b/tests/botstrap/internal/test_tokens.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.internal.tokens` module.""" + from __future__ import annotations import re diff --git a/tests/botstrap/test_colors.py b/tests/botstrap/test_colors.py index 7eddcaa2..668fae1f 100644 --- a/tests/botstrap/test_colors.py +++ b/tests/botstrap/test_colors.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.colors` module (`Color` and `CliColors` classes).""" + from __future__ import annotations from collections.abc import Callable diff --git a/tests/botstrap/test_flow.py b/tests/botstrap/test_flow.py index 69e97f4c..12668764 100644 --- a/tests/botstrap/test_flow.py +++ b/tests/botstrap/test_flow.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.flow` module (`Botstrap` class).""" + from __future__ import annotations import asyncio diff --git a/tests/botstrap/test_options.py b/tests/botstrap/test_options.py index 54636628..7e50bf15 100644 --- a/tests/botstrap/test_options.py +++ b/tests/botstrap/test_options.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.options` module (`Option` and `Option.Results` classes).""" + from __future__ import annotations from typing import Any diff --git a/tests/botstrap/test_strings.py b/tests/botstrap/test_strings.py index 49c5db83..688ae9f4 100644 --- a/tests/botstrap/test_strings.py +++ b/tests/botstrap/test_strings.py @@ -1,4 +1,5 @@ """Tests for the `botstrap.strings` module (`CliStrings` class).""" + from __future__ import annotations from collections.abc import Callable