diff --git a/src/spellsolver.py b/src/spellsolver.py index 0374200..77a3ce9 100644 --- a/src/spellsolver.py +++ b/src/spellsolver.py @@ -31,20 +31,6 @@ def process_node( swaps=swaps, ) - def process_path_aux( - self, - tile: GameTile, - node: TrieNode, - word: str, - path: List[GameTile], - swap: int, - letter: str, - ) -> Generator[ResultWord, None, None]: - actual_node = node.get_letter(letter) - if actual_node: - actual_word = word + letter - yield from self.process_node(actual_node, actual_word, path) - yield from self.process_path(tile, actual_node, actual_word, path, swap) def process_path_aux( self, tile: GameTile, diff --git a/src/utils/iteration.py b/src/utils/iteration.py deleted file mode 100644 index 46a66c2..0000000 --- a/src/utils/iteration.py +++ /dev/null @@ -1,25 +0,0 @@ -from itertools import tee -from typing import Iterable - - -def pairwise(iterable: Iterable) -> Iterable: - """ - Generate pairs of consecutive elements from an iterable. - - This function takes an iterable and returns an iterator that generates - pairs of consecutive elements from the input iterable. Each pair consists - of two adjacent elements. The input iterable is consumed in a single pass. - - Args: - iterable (Iterable): An iterable sequence of elements. - - Yields: - Iterable: An iterator that yields pairs of consecutive elements. - - Example: - >>> list(pairwise('ABCDEFG')) - [('A', 'B'), ('B', 'C'), ('C', 'D'), ('D', 'E'), ('E', 'F'), ('F', 'G')] - """ - a, b = tee(iterable) - next(b, None) - return zip(a, b) diff --git a/src/utils/iteration_test.py b/src/utils/iteration_test.py deleted file mode 100644 index d4aa46d..0000000 --- a/src/utils/iteration_test.py +++ /dev/null @@ -1,27 +0,0 @@ -import unittest -from iteration import pairwise - - -class TestPairwiseFunction(unittest.TestCase): - def test_empty_input(self): - result = list(pairwise([])) - self.assertEqual(result, []) - - def test_single_element_input(self): - result = list(pairwise([1])) - self.assertEqual(result, []) - - def test_normal_input(self): - result = list(pairwise([1, 2, 3, 4, 5])) - self.assertEqual(result, [(1, 2), (2, 3), (3, 4), (4, 5)]) - - def test_string_input(self): - result = list(pairwise("ABCDEFG")) - self.assertEqual( - result, - [("A", "B"), ("B", "C"), ("C", "D"), ("D", "E"), ("E", "F"), ("F", "G")], - ) - - -if __name__ == "__main__": - unittest.main()