Passed
Push — master ( 66020a...b25270 )
by Dean
03:03
created

LikedLists   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 41.67%
Metric Value
dl 0
loc 23
ccs 5
cts 12
cp 0.4167
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 10 1
A create_playlist() 0 8 2
1 1
from plugin.sync.core.enums import SyncData, SyncMedia, SyncMode
0 ignored issues
show
Unused Code introduced by
Unused SyncMedia imported from plugin.sync.core.enums
Loading history...
2 1
from plugin.sync.modes.fast_pull.lists.base import Lists
3
4 1
import elapsed
5 1
import logging
6
7 1
log = logging.getLogger(__name__)
8
9
10 1
class LikedLists(Lists):
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...
Coding Style introduced by
This class has no __init__ method.
Loading history...
11 1
    data = [SyncData.Liked]
12 1
    mode = SyncMode.FastPull
13
14 1
    @elapsed.clock
15
    def run(self):
16
        # Retrieve sections
17
        p_sections, p_sections_map = self.sections()
0 ignored issues
show
Bug introduced by
The Instance of LikedLists does not seem to have a member named sections.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Unused Code introduced by
The variable p_sections seems to be unused.
Loading history...
18
19
        # Retrieve playlists
20
        p_playlists = dict(self.get_playlists())
21
22
        # Process list changes
23
        self.process(SyncData.Liked, p_playlists, p_sections_map)
24
25 1
    def create_playlist(self, uri, name):
26
        # Check if playlist creation is enabled
27
        if self.configuration['sync.lists.liked.playlists'] is False:
0 ignored issues
show
Bug introduced by
The Instance of LikedLists does not seem to have a member named configuration.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
28
            log.info('No playlist found named %r ("Create playlist in plex" not enabled)', name)
29
            return None
30
31
        # Create playlist
32
        return super(LikedLists, self).create_playlist(uri, name)
33