OSMList.append_way()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 3
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
# -*- coding: utf-8 -*-
0 ignored issues
show
Coding Style Naming introduced by
Module name "OSMObjects" doesn't conform to snake_case naming style ('[^\\W\\dA-Z][^\\WA-Z]*$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing module docstring
Loading history...
2
3
try:
4
    import logging
5
    import sys
6
    import datetime
7
    from osm_poi_matchmaker.libs.osm import timestamp_now
0 ignored issues
show
Unused Code introduced by
Unused timestamp_now imported from osm_poi_matchmaker.libs.osm
Loading history...
8
    from osm_poi_matchmaker.dao.data_structure import OSM_object_type
9
except ImportError as err:
10
    logging.error('Error %s import module: %s', __name__, err)
11
    logging.exception('Exception occurred')
12
13
    sys.exit(128)
14
15
16
class OSMGeneral(object):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Class 'OSMGeneral' inherits from object, can be safely removed from bases in python3
Loading history...
17
18
    def __init__(self, osmid: int = -1, version: int = 9999, user: str = 'kami911', uid: int = '8635934',
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (105/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
best-practice introduced by
Too many arguments (7/5)
Loading history...
19
                 timestamp: datetime = datetime.datetime.now(), tags: dict = None):
20
        self.id = osmid
0 ignored issues
show
Coding Style Naming introduced by
Attribute name "id" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
21
        self.version = version
22
        self.user = user
23
        self.uid = uid
24
        self.timestamp = timestamp
25
        self.type = None
26
        self.tags = tags
27
28
29
class OSMNode(OSMGeneral):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
best-practice introduced by
Too many instance attributes (9/7)
Loading history...
30
31
    def __init__(self, osmid: int = -1, version: int = 9999, user: str = 'kami911', uid: int = '8635934',
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (105/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
Bug introduced by
The __init__ method of the super-class OSMGeneral is not called.

It is generally advisable to initialize the super-class by calling its __init__ method:

class SomeParent:
    def __init__(self):
        self.x = 1

class SomeChild(SomeParent):
    def __init__(self):
        # Initialize the super class
        SomeParent.__init__(self)
Loading history...
best-practice introduced by
Too many arguments (9/5)
Loading history...
32
                 timestamp: datetime = datetime.datetime.now(), tags: dict = None,
33
                 lat: float = None, lon: float = None):
34
        self.id = osmid
35
        self.version = version
36
        self.user = user
37
        self.uid = uid
38
        self.timestamp = timestamp
39
        self.tags = tags
40
        self.lat = lat
41
        self.lon = lon
42
        self.type = OSM_object_type.node
43
44
45
class OSMWay(OSMGeneral):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
best-practice introduced by
Too many instance attributes (8/7)
Loading history...
46
47
    def __init__(self, osmid: int = -1, version: int = 9999, user: str = 'kami911', uid: int = '8635934',
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (105/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
Bug introduced by
The __init__ method of the super-class OSMGeneral is not called.

It is generally advisable to initialize the super-class by calling its __init__ method:

class SomeParent:
    def __init__(self):
        self.x = 1

class SomeChild(SomeParent):
    def __init__(self):
        # Initialize the super class
        SomeParent.__init__(self)
Loading history...
best-practice introduced by
Too many arguments (8/5)
Loading history...
48
                 timestamp: datetime = datetime.datetime.now(), tags: dict = None, nodes: list = None):
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (103/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
49
        self.id = osmid
50
        self.version = version
51
        self.user = user
52
        self.uid = uid
53
        self.timestamp = timestamp
54
        self.tags = tags
55
        self.nodes = nodes
56
        self.type = OSM_object_type.way
57
58
59
class OSMList(object):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Class 'OSMList' inherits from object, can be safely removed from bases in python3
Loading history...
60
61
    def __init__(self, nodes: list = None, ways: list = None):
62
        self.nodes = nodes
63
        self.ways = ways
64
65
    def append_node(self, osmid, osm_node):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
66
        self.nodes[osmid] = osm_node
67
68
    def append_way(self, osmid, osm_way):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
69
        self.ways[osmid] = osm_way
70
71
    def print(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
72
        print(self.nodes)
73
        print(self.ways)
74
        for key, value in self.nodes.items():
0 ignored issues
show
Unused Code introduced by
The variable value seems to be unused.
Loading history...
75
            print(key)
76
        for key, value in self.ways.items():
77
            print(key)
78