nextcloud.base   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 32
dl 0
loc 51
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A WithRequester.__init__() 0 2 1
A WithRequester.requester() 0 7 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A datetime_to_expire_date() 0 2 1
1
# -*- coding: utf-8 -*-
2
import enum
3
4
5
class WithRequester(object):
6
7
    API_URL = NotImplementedError
8
9
    def __init__(self, requester):
10
        self._requester = requester
11
12
    @property
13
    def requester(self):
14
        """ Get requester instance """
15
        # dynamically set API_URL for requester
16
        self._requester.API_URL = self.API_URL
17
        self._requester.SUCCESS_CODE = getattr(self, 'SUCCESS_CODE', None)
18
        return self._requester
19
20
21
class OCSCode(enum.IntEnum):
22
    OK = 100
23
    SERVER_ERROR = 996
24
    NOT_AUTHORIZED = 997
25
    NOT_FOUND = 998
26
    UNKNOWN_ERROR = 999
27
28
29
class ShareType(enum.IntEnum):
30
    USER = 0
31
    GROUP = 1
32
    PUBLIC_LINK = 3
33
    FEDERATED_CLOUD_SHARE = 6
34
35
36
class Permission(enum.IntEnum):
37
    """ Permission for Share have to be sum of selected permissions """
38
    READ = 1
39
    UPDATE = 2
40
    CREATE = 4
41
    DELETE = 8
42
    SHARE = 16
43
    ALL = 31
44
45
46
QUOTA_UNLIMITED = -3
47
48
49
def datetime_to_expire_date(date):
50
    return date.strftime("%Y-%m-%d")
51