Passed
Push — master ( 64ad20...04166b )
by Dean
02:49
created

Identifier   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%
Metric Value
dl 0
loc 21
ccs 15
cts 15
cp 1
rs 10
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
B get_ids() 0 20 5
1 1
from plugin.core.constants import GUID_SERVICES
2
3 1
from plex_metadata import Guid
4 1
import logging
5
6
7 1
log = logging.getLogger(__name__)
8
9
10 1
class Identifier(object):
11 1
    @classmethod
12 1
    def get_ids(cls, guid, strict=True):
13 1
        ids = {}
14
15 1
        if not guid:
16 1
            return ids
17
18 1
        if type(guid) is str:
19
            # Parse raw guid
20 1
            guid = Guid.parse(guid)
21
22 1
        if guid.service in GUID_SERVICES:
23 1
            ids[guid.service] = guid.id
24 1
        elif not strict:
25 1
            log.info('Unknown identifier service: "%s"', guid.service)
26
        else:
27 1
            log.info('Unknown identifier service: "%s" [strict]', guid.service)
28 1
            return None
29
30
        return ids
31