Passed
Push — develop ( 325416...706c15 )
by Dean
02:50
created

ScrobbleDuplicationPeriod

Complexity

Total Complexity 0

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 100%
Metric Value
wmc 0
dl 0
loc 8
ccs 7
cts 7
cp 1
1 1
class Enum(object):
2 1
    @classmethod
3
    def parse(cls, value):
4
        options = cls.options()
5
6
        result = []
7
8
        for k, v in options.items():
0 ignored issues
show
Unused Code introduced by
The variable k seems to be unused.
Loading history...
9
            if type(v) is not int or v == 0:
10
                continue
11
12
            if value == 0 or (value & v) == v:
13
                result.append(v)
14
15
        return result
16
17 1
    @classmethod
18
    def options(cls):
19
        result = {}
20
21
        for key in dir(cls):
22
            if key.startswith('_'):
23
                continue
24
25
            result[key] = getattr(cls, key)
26
27
        return result
28
29
30 1
class SyncActionMode(Enum):
31 1
    Update  = 0x00
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Update = 0x00
^
Loading history...
32 1
    Log     = 0x01
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Log = 0x01
^
Loading history...
33
34
35 1
class SyncProfilerMode(Enum):
36 1
    Disabled    = None
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Disabled = None
^
Loading history...
37 1
    Basic       = 0x01
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Basic = 0x01
^
Loading history...
38
39
40 1
class SyncConflictResolution(Enum):
41 1
    Latest  = 0x00
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Latest = 0x00
^
Loading history...
42 1
    Trakt   = 0x01
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Trakt = 0x01
^
Loading history...
43 1
    Plex    = 0x02
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Plex = 0x02
^
Loading history...
44
45
46 1
class SyncData(Enum):
47 1
    All             = 0
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
All = 0
^
Loading history...
48 1
    Collection      = 1
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Collection = 1
^
Loading history...
49 1
    Playback        = 2
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Playback = 2
^
Loading history...
50 1
    Ratings         = 4
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Ratings = 4
^
Loading history...
51 1
    Watched         = 8
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Watched = 8
^
Loading history...
52 1
    Watchlist       = 16
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Watchlist = 16
^
Loading history...
53
54
    # Lists
55 1
    Liked           = 32
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Liked = 32
^
Loading history...
56 1
    Personal        = 64
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Personal = 64
^
Loading history...
57
58 1
    __titles__ = None
59
60 1
    @classmethod
61
    def title(cls, value):
62
        if cls.__titles__ is None:
63
            # Build titles map
64
            cls.__titles__ = {
65
                cls.All:           'All',
66
                cls.Collection:    'Collection',
67
                cls.Playback:      'Playback',
68
                cls.Ratings:       'Ratings',
69
                cls.Watched:       'Watched',
70
                cls.Watchlist:     'Watchlist'
71
            }
72
73
        return cls.__titles__.get(value)
74
75
76 1
class ScrobbleDuplicationPeriod(Enum):
77 1
    H1      = 1 * 60
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
H1 = 1 * 60
^
Loading history...
78 1
    H3      = 3 * 60
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
H3 = 3 * 60
^
Loading history...
79 1
    H6      = 6 * 60
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
H6 = 6 * 60
^
Loading history...
80 1
    H12     = 12 * 60
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
H12 = 12 * 60
^
Loading history...
81
82 1
    D1      = 1 * 24 * 60
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
D1 = 1 * 24 * 60
^
Loading history...
83 1
    D7      = 7 * 24 * 60
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
D7 = 7 * 24 * 60
^
Loading history...
84
85
86 1
class SyncIdleDelay(Enum):
87 1
    M15     = 15
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
M15 = 15
^
Loading history...
88 1
    M30     = 30
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
M30 = 30
^
Loading history...
89
90 1
    H1      = 1 * 60
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
H1 = 1 * 60
^
Loading history...
91
92
93 1
class SyncInterval(Enum):
94 1
    M15     = '*/15 * * * *'
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
M15 = '*/15 * * * *'
^
Loading history...
95 1
    M30     = '*/30 * * * *'
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
M30 = '*/30 * * * *'
^
Loading history...
96
97 1
    H1      = '0 * * * *'
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
H1 = '0 * * * *'
^
Loading history...
98 1
    H3      = '0 */3 * * *'
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
H3 = '0 */3 * * *'
^
Loading history...
99 1
    H6      = '0 */6 * * *'
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
H6 = '0 */6 * * *'
^
Loading history...
100 1
    H12     = '0 */12 * * *'
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
H12 = '0 */12 * * *'
^
Loading history...
101
102 1
    D1      = '0 0 * * *'
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
D1 = '0 0 * * *'
^
Loading history...
103 1
    D7      = '0 0 */7 * *'
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
D7 = '0 0 */7 * *'
^
Loading history...
104
105
106 1
class SyncMedia(Enum):
107 1
    All         = 0
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
All = 0
^
Loading history...
108 1
    Movies      = 1
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Movies = 1
^
Loading history...
109 1
    Shows       = 2
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Shows = 2
^
Loading history...
110 1
    Seasons     = 4
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Seasons = 4
^
Loading history...
111 1
    Episodes    = 8
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Episodes = 8
^
Loading history...
112 1
    Lists       = 16
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Lists = 16
^
Loading history...
113
114 1
    __titles__ = None
115
116 1
    @classmethod
117
    def title(cls, value):
118
        if cls.__titles__ is None:
119
            # Build titles map
120
            cls.__titles__ = {
121
                cls.All:        'All',
122
                cls.Movies:     'Movies',
123
                cls.Shows:      'Shows',
124
                cls.Seasons:    'Seasons',
125
                cls.Episodes:   'Episodes',
126
            }
127
128
        return cls.__titles__.get(value)
129
130
131 1
class SyncMode(Enum):
132 1
    Full        = 0x00
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Full = 0x00
^
Loading history...
133 1
    Pull        = 0x01
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Pull = 0x01
^
Loading history...
134 1
    Push        = 0x02
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
Push = 0x02
^
Loading history...
135 1
    FastPull    = 0x04
0 ignored issues
show
Coding Style introduced by
Exactly one space required before assignment
FastPull = 0x04
^
Loading history...
136
137 1
    __titles__ = None
138
139 1
    @classmethod
140
    def title(cls, value):
141
        if cls.__titles__ is None:
142
            # Build titles map
143
            cls.__titles__ = {
144
                cls.Full:       'Full',
145
                cls.Pull:       'Pull',
146
                cls.Push:       'Push',
147
                cls.FastPull:   'Quick Pull'
148
            }
149
150
        return cls.__titles__.get(value)
151