Total Complexity | 2 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | from coala_decorators.decorators import generate_repr |
||
4 | @generate_repr() |
||
5 | class PackageRequirement: |
||
6 | """ |
||
7 | This class helps keeping track of bear requirements. It should simply |
||
8 | be appended to the REQUIREMENTS tuple inside the Bear class. |
||
9 | |||
10 | You can check whether the requirements are fulfilled using the check |
||
11 | method: |
||
12 | |||
13 | >>> PR = PackageRequirement('pip', 'coala_decorators', '0.2.1') |
||
14 | >>> PR.check() |
||
15 | Traceback (most recent call last): |
||
16 | ... |
||
17 | NotImplementedError |
||
18 | """ |
||
19 | |||
20 | def __init__(self, manager: str, package: str, version=""): |
||
21 | """ |
||
22 | Constructs a new PackageRequirement. |
||
23 | |||
24 | :param manager: A string with the name of the manager (pip, npm, etc). |
||
25 | :param package: A string with the name of the package to be installed. |
||
26 | :param version: A number that contains the version. Leave empty to |
||
27 | install the latest. |
||
28 | """ |
||
29 | self.manager = manager |
||
30 | self.package = package |
||
31 | self.version = version |
||
32 | |||
33 | def check(self): |
||
34 | """ |
||
35 | Check if the requirement is satisfied. |
||
36 | |||
37 | :return: Returns True if satisfied, False if not. |
||
38 | """ |
||
39 | raise NotImplementedError |
||
40 |