Total Complexity | 4 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 57.14% |
1 | 1 | from plugin.sync.core.enums import SyncMode |
|
13 | 1 | class FastPull(Mode): |
|
|
|||
14 | 1 | mode = SyncMode.FastPull |
|
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 | @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 | @elapsed.clock |
||
45 | def run(self): |
||
46 | # Run children |
||
47 | self.execute_children('run') |
||
48 | |||
49 | @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 |
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.