[pre-commit.ci] pre-commit autoupdate (#12623)

* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.10...v0.11.0)
- [github.com/abravalheri/validate-pyproject: v0.23 → v0.24](https://github.com/abravalheri/validate-pyproject/compare/v0.23...v0.24)

* Fix ruff issues

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
pre-commit-ci[bot]
2025-03-18 09:53:49 +01:00
committed by GitHub
parent 7ce998b91c
commit edf7c372a9
15 changed files with 26 additions and 28 deletions

View File

@ -54,7 +54,7 @@ def parse_grid(grid):
return False if a contradiction is detected.
"""
## To start, every square can be any digit; then assign values from the grid.
values = {s: digits for s in squares}
values = dict.fromkeys(squares, digits)
for s, d in grid_values(grid).items():
if d in digits and not assign(values, s, d):
return False ## (Fail if we can't assign d to square s.)
@ -203,7 +203,7 @@ def random_puzzle(assignments=17):
Note the resulting puzzle is not guaranteed to be solvable, but empirically
about 99.8% of them are solvable. Some have multiple solutions.
"""
values = {s: digits for s in squares}
values = dict.fromkeys(squares, digits)
for s in shuffled(squares):
if not assign(values, s, random.choice(values[s])):
break