Passed
Push — develop ( 850286...2f2c0e )
by Dean
03:07 queued 32s
created

Pull   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 50%
Metric Value
dl 0
loc 44
ccs 8
cts 16
cp 0.5
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 4 1
A start() 0 10 1
A construct() 0 7 1
A stop() 0 7 1
1 1
from plugin.sync.core.enums import SyncData, SyncMode
2 1
from plugin.sync.modes.core.base import Mode
3 1
from plugin.sync.modes.pull.movies import Movies
4 1
from plugin.sync.modes.pull.shows import Shows
5 1
from plugin.sync.modes.pull.lists import LikedLists, PersonalLists, Watchlist
6 1
import elapsed
7 1
import logging
8
9 1
log = logging.getLogger(__name__)
10
11
12 1
class Pull(Mode):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13 1
    data = SyncData.All
14 1
    mode = SyncMode.Pull
15
16 1
    children = [
17
        Movies,
18
        Shows,
19
20
        LikedLists,
21
        PersonalLists,
22
        Watchlist
23
    ]
24
25 1
    @elapsed.clock
26
    def construct(self):
27
        # Start progress tracking
28
        self.current.progress.start()
29
30
        # Construct children
31
        self.execute_children('construct')
32
33 1
    @elapsed.clock
34
    def start(self):
35
        # Fetch changes from trakt.tv
36
        self.trakt.refresh()
37
38
        # Build key table for lookups
39
        self.trakt.build_table()
40
41
        # Start children
42
        self.execute_children('start')
43
44 1
    @elapsed.clock
45
    def run(self):
46
        # Run children
47
        self.execute_children('run')
48
49 1
    @elapsed.clock
50
    def stop(self):
51
        # Stop children
52
        self.execute_children('stop')
53
54
        # Stop progress tracking
55
        self.current.progress.stop()
56