Skip to content

Commit

Permalink
Upgrade CI/lint tools (#111)
Browse files Browse the repository at this point in the history
* Update pre-commit tools

* Switch formatting from black to ruff-format

* CI: use GitHub output format for Ruff
  • Loading branch information
akx authored Nov 20, 2023
1 parent 1c3ae20 commit e3afdf4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: pre-commit/[email protected]
env:
RUFF_OUTPUT_FORMAT: github
mypy:
runs-on: ubuntu-latest
steps:
Expand Down
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.290
rev: v0.1.6
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
args:
- --quiet
7 changes: 5 additions & 2 deletions src/dynamicprompts/jinja_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ def wildcard(environment: Environment, wildcard_name: str) -> list[str]:
from dynamicprompts.generators import CombinatorialPromptGenerator
from dynamicprompts.wildcards import WildcardManager

wm: WildcardManager = environment.globals["wildcard_manager"] # type: ignore
generator: CombinatorialPromptGenerator = environment.globals["generators"]["combinatorial"] # type: ignore
wm = cast(WildcardManager, environment.globals["wildcard_manager"])
generator = cast(
CombinatorialPromptGenerator,
environment.globals["generators"]["combinatorial"], # type: ignore
)

return [str(r) for r in generator.generate(wm.to_wildcard(wildcard_name))]

Expand Down
2 changes: 1 addition & 1 deletion tests/parser/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_combinations(self):
variant_command = VariantCommand.from_literals_and_weights(ONE_TWO_THREE)

assert [
v.literal for v, in variant_command.get_value_combinations(1)
v.literal for (v,) in variant_command.get_value_combinations(1)
] == ONE_TWO_THREE

assert [
Expand Down

0 comments on commit e3afdf4

Please sign in to comment.