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

nextcloud.NextCloud.NextCloud.__init__()   A

Complexity

Conditions 5

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 14
rs 9.3333
c 0
b 0
f 0
cc 5
nop 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