Completed
Pull Request — master (#2364)
by Zatreanu
01:53
created

PipRequirement.__init__()   A

Complexity

Conditions 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 17
rs 9.4285
1
from coalib.bears.requirements.PackageRequirement import PackageRequirement
2
3
4
class PipRequirement(PackageRequirement):
5
    """
6
    This class is a subclass of ``PackageRequirement``, and helps specifying
7
    requirements from ``pip``, without using the manager name.
8
    """
9
10
    def __init__(self, package, version=""):
11
        """
12
        Constructs a new ``PipRequirement``, using the ``PackageRequirement``
13
        constructor.
14
15
        >>> pr = PipRequirement('setuptools', '19.2')
16
        >>> pr.manager
17
        'pip'
18
        >>> pr.package
19
        'setuptools'
20
        >>> pr.version
21
        '19.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, 'pip', package, version)
27