Passed
Push — main ( 3a0c28...4b9dc0 )
by Douglas
01:51
created

RandomSearch.__init__()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 4
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
from typing import Sequence
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
3
from mandos.model.concrete_hits import MetaHit
4
from mandos.search.meta import MetaSearch
5
6
7
class RandomSearch(MetaSearch[MetaHit]):
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
8
    """ """
9
10
    def __init__(self, key: str, seed: int, n: int):
0 ignored issues
show
Coding Style Naming introduced by
Argument name "n" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
11
        super().__init__(key, seed)
12
        self.n = n
0 ignored issues
show
Coding Style Naming introduced by
Attribute name "n" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
13
14
    def find(self, inchikey: str) -> Sequence[MetaHit]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
15
        r = str(self.random.randint(0, self.n))  # TODO
0 ignored issues
show
Coding Style introduced by
TODO and FIXME comments should generally be avoided.
Loading history...
Coding Style Naming introduced by
Variable name "r" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
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