Passed
Push — master ( 9792e6...87dae5 )
by Dean
08:18 queued 04:48
created

log_unsupported_guid()   B

Complexity

Conditions 5

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 5
c 2
b 0
f 0
dl 0
loc 19
ccs 0
cts 6
cp 0
crap 30
rs 8.5454
1
from plex_metadata import Guid
2
3
4
def log_unsupported_guid(logger, guid):
5
    if guid is None or guid.agent_id is None:
6
        return
7
8
    if guid and isinstance(guid, Guid):
9
        logger.warn('Unsupported guid: %%r (agent: %r)' % guid.agent_id, guid.value, extra={
10
            'original': guid.original,
11
            'event': {
12
                'module': __name__,
13
                'name': 'unsupported_guid',
14
                'key': (guid.agent_id, guid.value)
15
            }
16
        })
17
    else:
18
        logger.warn('Unsupported guid: %r', guid, extra={
19
            'event': {
20
                'module': __name__,
21
                'name': 'unsupported_guid',
22
                'key': guid
23
            }
24
        })
25