diff --git a/.github/workflows/downstream.yaml b/.github/workflows/downstream.yaml index a146c6d7..2fe2b476 100644 --- a/.github/workflows/downstream.yaml +++ b/.github/workflows/downstream.yaml @@ -8,6 +8,8 @@ on: # push: # branches: [main] +permissions: {} + jobs: tests: name: ${{ matrix.ref }} diff --git a/.github/workflows/news.yaml b/.github/workflows/news.yaml index 944f2ea8..d2b7f914 100644 --- a/.github/workflows/news.yaml +++ b/.github/workflows/news.yaml @@ -4,6 +4,8 @@ on: pull_request: types: [labeled, unlabeled, opened, reopened, synchronize] +permissions: {} + jobs: check-news-entry: name: news entry diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5c614c4f..ea4a92b4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,6 +4,8 @@ on: release: types: [published] +permissions: {} + jobs: build: name: Build diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 16240d5a..953fe81f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -8,6 +8,8 @@ on: env: PYTHONWARNDEFAULTENCODING: true +permissions: {} + jobs: Tests: name: ${{ matrix.os }} / ${{ matrix.python-version }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 094c2885..65eb6a48 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,15 +22,12 @@ repos: - id: check-docstring-first - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.9.5 hooks: - id: ruff - id: ruff-format - repo: https://github.com/woodruffw/zizmor-pre-commit - rev: v1.0.0 + rev: v1.3.0 hooks: - id: zizmor - # types and files can be removed with https://github.com/woodruffw/zizmor-pre-commit/pull/2 - types: [yaml] - files: \.github/workflows/.*$ diff --git a/src/cleo/descriptors/text_descriptor.py b/src/cleo/descriptors/text_descriptor.py index 96ad9d4c..5fb7f458 100644 --- a/src/cleo/descriptors/text_descriptor.py +++ b/src/cleo/descriptors/text_descriptor.py @@ -272,6 +272,6 @@ def _get_column_width(self, commands: Sequence[Command | str]) -> int: def _get_command_aliases_text(self, command: Command) -> str: if aliases := command.aliases: - return f"[{ '|'.join(aliases) }] " + return f"[{'|'.join(aliases)}] " return "" diff --git a/src/cleo/io/inputs/argv_input.py b/src/cleo/io/inputs/argv_input.py index d3487562..54cc1735 100644 --- a/src/cleo/io/inputs/argv_input.py +++ b/src/cleo/io/inputs/argv_input.py @@ -244,8 +244,7 @@ def _parse_argument(self, token: str) -> None: message = f"Too many arguments, expected arguments {all_names}" elif command_name: message = ( - f'No arguments expected for "{command_name}" command, ' - f'got "{token}"' + f'No arguments expected for "{command_name}" command, got "{token}"' ) else: message = f'No arguments expected, got "{token}"' diff --git a/src/cleo/ui/confirmation_question.py b/src/cleo/ui/confirmation_question.py index 04d8430f..8b2baa33 100644 --- a/src/cleo/ui/confirmation_question.py +++ b/src/cleo/ui/confirmation_question.py @@ -27,7 +27,7 @@ def __init__( def _write_prompt(self, io: IO) -> None: message = ( f"{self._question} (yes/no) " - f'[{"yes" if self._default else "no"}] ' + f"[{'yes' if self._default else 'no'}] " ) io.write_error(message) diff --git a/tests/ui/test_choice_question.py b/tests/ui/test_choice_question.py index 278ad9da..ead5f65e 100644 --- a/tests/ui/test_choice_question.py +++ b/tests/ui/test_choice_question.py @@ -13,23 +13,7 @@ def test_ask_choice(io: BufferedIO) -> None: - io.set_user_input( - "\n" - "1\n" - " 1 \n" - "John\n" - "1\n" - "\n" - "John\n" - "1\n" - "0,2\n" - " 0 , 2 \n" - "\n" - "\n" - "4\n" - "0\n" - "-2\n" - ) + io.set_user_input("\n1\n 1 \nJohn\n1\n\nJohn\n1\n0,2\n 0 , 2 \n\n\n4\n0\n-2\n") heroes = ["Superman", "Batman", "Spiderman"] question = ChoiceQuestion("What is your favorite superhero?", heroes, "2")