Test Setup Failed
Push — develop ( e459d6...12ef70 )
by Dean
02:19
created

LikedLists.run()   A

Complexity

Conditions 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 4.5185
Metric Value
cc 2
dl 0
loc 15
ccs 1
cts 7
cp 0.1429
crap 4.5185
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
    mode = SyncMode.FastPull
12
13 1
    @elapsed.clock
14
    def run(self):
15
        # Check if data is enabled
16
        if not self.is_data_enabled(SyncData.Liked):
0 ignored issues
show
Bug introduced by
The Instance of LikedLists does not seem to have a member named is_data_enabled.

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...
17
            log.debug('Liked list syncing has not been enabled')
18
            return
19
20
        # Retrieve sections
21
        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...
22
23
        # Retrieve playlists
24
        p_playlists = dict(self.get_playlists())
25
26
        # Process list changes
27
        self.process(SyncData.Liked, p_playlists, p_sections_map)
28
29 1
    def create_playlist(self, uri, name):
30
        # Check if playlist creation is enabled
31
        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...
32
            log.info('No playlist found named %r ("Create playlist in plex" not enabled)', name)
33
            return None
34
35
        # Create playlist
36
        return super(LikedLists, self).create_playlist(uri, name)
37