osm_poi_matchmaker.libs.compare_strings   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 11

1 Function

Rating   Name   Duplication   Size   Complexity  
C compare_strings() 0 13 11
1
# -*- coding: utf-8 -*-
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
3
try:
4
    import logging
5
    import sys
6
    import re
0 ignored issues
show
Unused Code introduced by
The import re seems to be unused.
Loading history...
7
except ImportError as err:
8
    logging.error('Error %s import module: %s', __name__, err)
9
    logging.exception('Exception occurred')
10
11
    sys.exit(128)
12
13
14
def compare_strings(string1, string2=''):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Unused Code introduced by
Either all return statements in a function should return an expression, or none of them should.
Loading history...
15
    # New string
16
    if (string1 is '' or string1 is None) and (string2 is not '' and string2 is not None):
0 ignored issues
show
unused-code introduced by
Unnecessary "elif" after "return"
Loading history...
introduced by
Comparison to literal
Loading history...
17
        return 'N'
18
    # Deleted string
19
    elif (string1 is not '' and string1 is not None) and (string2 is '' or string2 is None):
0 ignored issues
show
introduced by
Comparison to literal
Loading history...
20
        return 'D'
21
    # Modified string
22
    elif str(string1) != str(string2):
23
        return 'M'
24
    # Equal string
25
    elif str(string1) == str(string2):
26
        return 'E'
27