| Total Complexity | 2 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from typing import Sequence |
||
|
|
|||
| 2 | |||
| 3 | from mandos.model.concrete_hits import MetaHit |
||
| 4 | from mandos.search.meta import MetaSearch |
||
| 5 | |||
| 6 | |||
| 7 | class RandomSearch(MetaSearch[MetaHit]): |
||
| 8 | """ """ |
||
| 9 | |||
| 10 | def __init__(self, key: str, seed: int, n: int): |
||
| 11 | super().__init__(key, seed) |
||
| 12 | self.n = n |
||
| 13 | |||
| 14 | def find(self, inchikey: str) -> Sequence[MetaHit]: |
||
| 15 | r = str(self.random.randint(0, self.n)) # TODO |
||
| 16 | return [ |
||
| 17 | self._create_hit( |
||
| 18 | data_source=self._format_source(), |
||
| 19 | c_id=inchikey, |
||
| 20 | c_origin=inchikey, |
||
| 21 | c_matched=inchikey, |
||
| 22 | c_name=inchikey, |
||
| 23 | predicate=self._format_predicate(), |
||
| 24 | object_id=r, |
||
| 25 | object_name=r, |
||
| 26 | ) |
||
| 27 | ] |
||
| 28 | |||
| 29 | |||
| 30 | __all__ = ["RandomSearch"] |
||
| 31 |