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

LikedLists.create_playlist()   A

Complexity

Conditions 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 4.048
Metric Value
cc 2
dl 0
loc 8
ccs 1
cts 5
cp 0.2
crap 4.048
rs 9.4285
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