Skip to content
Open
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
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ packages = find:
package_dir =
= src
install_requires =
numba
numpy
colorama
tqdm
Expand All @@ -41,6 +40,7 @@ console_scripts =
[options.extras_require]
decision =
graphviz
numba

dev =
black
Expand Down
6 changes: 5 additions & 1 deletion src/doddle/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def main() -> None:
def parse_args(args: Sequence[str]) -> None:

parser = ArgumentParser()
subparsers = parser.add_subparsers()
subparsers = parser.add_subparsers(required=True)

run_parser = subparsers.add_parser("run")
run_parser.add_argument("--answer", required=True, type=Word)
Expand Down Expand Up @@ -124,4 +124,8 @@ def parse_args(args: Sequence[str]) -> None:
benchmark_parser.set_defaults(func=benchmark_performance)

namespace = parser.parse_args(args)
if not hasattr(namespace, "func"):
parser.print_help()
return

namespace.func(namespace)
2 changes: 0 additions & 2 deletions src/doddle/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Callable, Iterator, TypeVar

import numpy as np
from numba import njit # type: ignore

from .guess import Guess
from .scoring import Scorer
Expand Down Expand Up @@ -134,7 +133,6 @@ def to_histogram(solns_by_score: dict[int, WordSeries]) -> np.ndarray:
return vector


@njit
def _populate_histogram(matrix: np.ndarray, row: int, hist: np.ndarray) -> bool:
"""Aggressive optimisation of the histogram creation.

Expand Down
2 changes: 0 additions & 2 deletions src/doddle/scoring.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
from numba import int8, int32, jit # type: ignore

from .words import Word

Expand Down Expand Up @@ -72,7 +71,6 @@ def score_word(self, solution: Word, guess: Word) -> int:
return _score_word_jit(solution.vector, guess.vector, self._powers)


@jit(int32(int8[:], int8[:], int32[:]), nopython=True)
def _score_word_jit(solution_array: np.ndarray, guess_array: np.ndarray, powers: np.ndarray) -> int:
"""Optimised internal call to score a word. See Solver.score_word(...) for details."""

Expand Down
2 changes: 1 addition & 1 deletion src/doddle/words.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def __find_index(self, value: str | Word) -> int:
def __getitem__(self, s: slice | np.ndarray) -> WordSeries:

is_slice = isinstance(s, slice)
is_mask = isinstance(s, np.ndarray) and s.dtype == np.bool8
is_mask = isinstance(s, np.ndarray) and s.dtype == np.bool_
is_index = isinstance(s, np.ndarray) and s.dtype == np.int_
can_index = is_slice or is_mask or is_index

Expand Down