Passed
Pull Request — master (#27)
by
unknown
01:13
created

nextcloud.NextCloud   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 15
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A NextCloud.__init__() 0 14 5
1
from .requester import Requester, OCSRequester, WebDAVRequester
2
from .api_wrappers import OCS_API_CLASSES, WEBDAV_CLASS
3
4
5
class NextCloud(object):
6
7
    def __init__(self, endpoint, user, password, json_output=True):
8
        self.query_components = []
9
10
        ocs_requester = OCSRequester(endpoint, user, password, json_output)
11
        webdav_requester = WebDAVRequester(endpoint, user, password)
12
13
        self.functionality_classes = [api_class(ocs_requester) for api_class in OCS_API_CLASSES]
14
        self.functionality_classes.append(WEBDAV_CLASS(webdav_requester, json_output=json_output))
15
16
        for functionality_class in self.functionality_classes:
17
            for potential_method in dir(functionality_class):
18
                if potential_method.startswith('_') or not callable(getattr(functionality_class, potential_method)):
19
                    continue
20
                setattr(self, potential_method, getattr(functionality_class, potential_method))
21