| Total Complexity | 1 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from coalib.bears.requirements.PackageRequirement import PackageRequirement |
||
| 4 | class NpmRequirement(PackageRequirement): |
||
| 5 | """ |
||
| 6 | This class is a subclass of ``PackageRequirement``, and helps specifying |
||
| 7 | requirements from ``npm``, without using the manager name. |
||
| 8 | """ |
||
| 9 | |||
| 10 | def __init__(self, package, version=""): |
||
| 11 | """ |
||
| 12 | Constructs a new ``NpmRequirement``, using the ``PackageRequirement`` |
||
| 13 | constructor. |
||
| 14 | |||
| 15 | >>> pr = NpmRequirement('ramllint', '6.2') |
||
| 16 | >>> pr.manager |
||
| 17 | 'npm' |
||
| 18 | >>> pr.package |
||
| 19 | 'ramllint' |
||
| 20 | >>> pr.version |
||
| 21 | '6.2' |
||
| 22 | |||
| 23 | :param package: A string with the name of the package to be installed. |
||
| 24 | :param version: A version string. Leave empty to specify latest version. |
||
| 25 | """ |
||
| 26 | PackageRequirement.__init__(self, 'npm', package, version) |
||
| 27 |