Total Complexity | 2 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import abc |
||
|
|||
2 | from typing import TypeVar |
||
3 | |||
4 | from pocketutils.core.exceptions import XValueError |
||
5 | |||
6 | from mandos.model.apis.hmdb_api import HmdbApi |
||
7 | from mandos.model.hits import AbstractHit |
||
8 | from mandos.model.searches import Search |
||
9 | |||
10 | H = TypeVar("H", bound=AbstractHit, covariant=True) |
||
11 | |||
12 | |||
13 | class HmdbSearch(Search[H], metaclass=abc.ABCMeta): |
||
14 | def __init__(self, key: str, api: HmdbApi): |
||
15 | if api is None: |
||
16 | raise XValueError(f"{self.__class__.__name__} got a null API") |
||
17 | super().__init__(key) |
||
18 | self.api = api |
||
19 | |||
20 | |||
21 | __all__ = ["HmdbSearch"] |
||
22 |