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

PackageRequirement   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __init__() 0 9 1
A check() 0 5 1
1
from coala_decorators.decorators import generate_repr
2
3
4
@generate_repr()
5
class PackageRequirement:
6
7
    def __init__(self, manager: str, package: str, version: str):
8
        """
9
        :param manager: A string with the name of the manager (pip, npm, etc).
10
        :param package: A string with the name of the package to be installed.
11
        :param version: A number that contains the version.
12
        """
13
        self.manager = manager
14
        self.package = package
15
        self.version = version
16
17
    def check(self):
18
        """
19
        Check if the requirement is satisfied.
20
        """
21
        raise NotImplementedError
22
23
24
class PythonRequirement(PackageRequirement):
25
26
    def __init__(self, package, version):
27
        PackageRequirement.__init__(self, 'pip', package, version)
28
29
    def multiple(self, *args):
0 ignored issues
show
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
30
        return args
31