Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ repos:
- id: uv-lock
- id: uv-sync
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.22
rev: v0.16.0
hooks:
- id: ruff-format
types_or: [python, pyi, jupyter, markdown]
- id: ruff-check
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.411
Expand Down
4 changes: 2 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tasks:
status:
- grep -q 'pre-commit\.com' .git/hooks/*
cmds:
- uv run pre-commit install
- uvx pre-commit install

dev:test:
aliases:
Expand All @@ -43,7 +43,7 @@ tasks:
deps:
- dev:install-precommit
cmds:
- pre-commit run --files .github/renovate.json renovate-config-validator
- uvx pre-commit run --files .github/renovate.json renovate-config-validator

dev:lint:code:
desc: Lint the source code
Expand Down
2 changes: 2 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ the player has made their initial move yet.

You can add and remove tiles from both the rack and the table:

<!-- fmt: off -->
```pycon
>>> from rummikub_solver import RuleSet
>>> ruleset = RuleSet()
Expand All @@ -77,6 +78,7 @@ You can add and remove tiles from both the rack and the table:
>>> game.add_table(black[10], orange[10], red[10], joker)
>>> game.remove_table(joker)
```
<!-- fmt: on -->

You can then introspect their states as either a counter or a sorted list:

Expand Down
12 changes: 1 addition & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ scip = ["PySCIPOpt"]
[dependency-groups]
dev = [
"annotated-types>=0.7.0",
"ruff",
"ruff>=0.16",
"pyright",
"pytest>=8.4.0",
"pytest-cov>=6.2.1",
Expand Down Expand Up @@ -70,16 +70,6 @@ required-version = "~=0.9"
[tool.uv-dynamic-versioning]
fallback-version = "0.0.0"

[tool.ruff.lint]
extend-select = [
"B", # bugbear
"D", # pydocstyle
"I", # isort
"SIM", # simplify
"UP", # pyupgrade
"RUF", # additional ruff rules
]

[tool.ruff.lint.per-file-ignores]
"tests/**" = ["D1"] # tests do not require a docstring

Expand Down
3 changes: 1 addition & 2 deletions src/rummikub_solver/_gamestate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from collections import Counter
from collections.abc import Iterable, Sequence
from typing import Any

import numpy as np

Expand Down Expand Up @@ -217,7 +216,7 @@ def remove_table(self, *tiles: Tile | int) -> None:
np.subtract.at(table, np.array(tiles) - 1, 1)
table[table < 0] = 0 # in case we removed tiles not on the table

def __eq__(self, other: Any) -> bool:
def __eq__(self, other: object) -> bool:
if not isinstance(other, GameState): # pragma: no cover
return NotImplemented
return (self._initial, self._rack, self._table) == (
Expand Down
8 changes: 3 additions & 5 deletions src/rummikub_solver/_ruleset.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,14 +467,12 @@ def _combine_with_jokers(
# jokers. For groups, do not generate further combinations for longer sets, as
# these would leave jokers free for the next player to take. For runs
# only generate 'inner' jokers.
longer: Callable[[Sequence[Tile]], Iterable[tuple[Tile, ...]]] = lambda s: [ # noqa: E731
longer: Callable[[Sequence[Tile]], Iterable[tuple[Tile, ...]]] = lambda s: [
tuple(s)
]
if runs:
longer = ( # noqa: E731
lambda s: (
(s[0], *c, s[-1]) for c in combinations([*s[1:-1], *js], len(s) - 2)
)
longer = lambda s: (
(s[0], *c, s[-1]) for c in combinations([*s[1:-1], *js], len(s) - 2)
)
js = [j] * self._jokers
comb = (
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from rummikub_solver import GameState, MILPSolver, RuleSet

from .milp_solver_selection import * # noqa: F403
from .milp_solver_selection import *

if TYPE_CHECKING:
# Define the (virtual) solver_backend fixture in type checking terms,
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def _repr_compare(self, other_side: Any) -> list[str]:

__hash__ = None # pyright: ignore[reportAssignmentType]

def __eq__(self, actual: Any) -> bool:
def __eq__(self, actual: object) -> bool:
return actual == self.a or actual == self.b

def __repr__(self) -> str:
Expand Down
40 changes: 20 additions & 20 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading