Passed
Push — dependabot/pip/flake8-bugbear-... ( 82a4d5...16d864 )
by
unknown
02:18
created

mandos.model.pubchem_api.QueryingPubchemApi._strip_by_key_in_place()   B

Complexity

Conditions 7

Size

Total Lines 10
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 7
eloc 10
nop 3
dl 0
loc 10
rs 8
c 0
b 0
f 0
1
"""
2
PubChem querying API.
3
"""
4
from __future__ import annotations
5
6
import abc
7
import logging
8
from typing import Optional, Union, FrozenSet
9
10
from mandos.model import CompoundNotFoundError
11
from mandos.model.pubchem_support.pubchem_data import PubchemData
12
13
logger = logging.getLogger("mandos")
14
15
16
class PubchemCompoundLookupError(CompoundNotFoundError):
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
17
    """"""
18
19
20
class PubchemApi(metaclass=abc.ABCMeta):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
21
    def fetch_data_from_cid(self, cid: int) -> Optional[PubchemData]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
22
        # separated from fetch_data to make it completely clear what an int value means
23
        # noinspection PyTypeChecker
24
        return self.fetch_data(cid)
25
26
    def fetch_data(self, inchikey: str) -> Optional[PubchemData]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
27
        raise NotImplementedError()
28
29
    def find_similar_compounds(self, inchi: Union[int, str], min_tc: float) -> FrozenSet[int]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
30
        raise NotImplementedError()
31
32
33
__all__ = ["PubchemApi", "PubchemCompoundLookupError"]
34