Code Duplication    Length = 14-14 lines in 2 locations

osm_poi_matchmaker/libs/geo.py 2 locations

@@ 51-64 (lines=14) @@
48
                return None
49
        else:
50
            lat = latitude
51
        if not isinstance(longitude, float):
52
            lo = PATTERN_COORDINATE.search(longitude.replace(',', '.').strip())
53
            try:
54
                if lo is not None:
55
                    lon = lo.group()
56
                else:
57
                    return None
58
            except (AttributeError, IndexError) as e:
59
                logging.error('%s;%s', latitude, longitude)
60
                logging.error(e)
61
                logging.exception('Exception occurred')
62
63
                return None
64
        else:
65
            lon = longitude
66
        return geom_point(lat, lon, proj)
67
    else:
@@ 36-49 (lines=14) @@
33
    :return: Validated coordinates or None on error
34
    """
35
    if (latitude is not None and latitude != '') and (longitude is not None and longitude != ''):
36
        if not isinstance(latitude, float):
37
            la = PATTERN_COORDINATE.search(latitude.replace(',', '.').strip())
38
            try:
39
                if la is not None:
40
                    lat = la.group()
41
                else:
42
                    return None
43
            except (AttributeError, IndexError) as e:
44
                logging.error('%s;%s', latitude, longitude)
45
                logging.error(e)
46
                logging.exception('Exception occurred')
47
48
                return None
49
        else:
50
            lat = latitude
51
        if not isinstance(longitude, float):
52
            lo = PATTERN_COORDINATE.search(longitude.replace(',', '.').strip())