Passed
Push — master ( 42fda8...795c0e )
by KAMI
02:31
created

osm_poi_matchmaker.dao.data_structure   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 226
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 195
dl 0
loc 226
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A POI_common.__repr__() 0 2 1
A City.__repr__() 0 2 1
A Street_type.__repr__() 0 2 1
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
    from sqlalchemy import Column, ForeignKey, ForeignKeyConstraint, UniqueConstraint
0 ignored issues
show
Unused Code introduced by
Unused ForeignKeyConstraint imported from sqlalchemy
Loading history...
7
    from sqlalchemy import Boolean, Integer, BigInteger, Unicode, DateTime, Time, Enum, Float, JSON, func
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...
8
    from sqlalchemy.ext.declarative import declarative_base
9
    from sqlalchemy.orm import synonym, relationship
10
    from geoalchemy2 import Geometry
11
    import enum
12
    from osm_poi_matchmaker.utils import config
13
except ImportError as err:
14
    logging.error('Error %s import module: %s', __name__, err)
15
    logging.exception('Exception occurred')
16
17
    sys.exit(128)
18
19
Base = declarative_base()
20
21
22
class OSM_object_type(enum.Enum):
0 ignored issues
show
Coding Style Naming introduced by
Class name "OSM_object_type" doesn't conform to PascalCase naming style ('[^\\W\\da-z][^\\W_]+$' 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 class docstring
Loading history...
23
    node = 0
24
    way = 1
25
    relation = 2
26
27
28
class POI_type(enum.Enum):
0 ignored issues
show
Coding Style Naming introduced by
Class name "POI_type" doesn't conform to PascalCase naming style ('[^\\W\\da-z][^\\W_]+$' 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 class docstring
Loading history...
29
    shop = 0
30
    fuel = 1
31
    bank = 2
32
    atm = 3
33
    post_office = 4
34
    vending_machine = 5
35
    pharmacy = 6
36
    chemist = 7
37
    bicycle_rental = 8
38
    vending_machine_cheques = 9
39
    vending_machine_parcel_pickup = 10
40
    vending_machine_parcel_mail_in = 11
41
    vending_machine_parcel_pickup_and_mail_in = 12
42
    vending_machine_parking_tickets = 13
43
    tobacco = 14
44
    clothes = 15
45
    doityourself = 16
46
    cosmetics = 17
47
    furniture = 18
48
    charging_station = 19
49
50
51
class POI_address(Base):
0 ignored issues
show
Coding Style Naming introduced by
Class name "POI_address" doesn't conform to PascalCase naming style ('[^\\W\\da-z][^\\W_]+$' 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 class docstring
Loading history...
52
    __tablename__ = 'poi_address'
53
    _plural_name_ = 'poi_address'
54
    pa_id = Column(Integer, primary_key=True, index=True)
55
    id = synonym('pa_id')
56
    poi_common_id = Column(ForeignKey('poi_common.pc_id'), index=True)
57
    poi_branch = Column(Unicode(128), nullable=True, index=True)
58
    poi_addr_city = Column(ForeignKey('city.city_id'), index=True)
59
    poi_postcode = Column(Integer)
60
    poi_city = Column(Unicode(64))
61
    poi_addr_street = Column(Unicode(128))
62
    poi_addr_housenumber = Column(Unicode(16))
63
    poi_conscriptionnumber = Column(Unicode(16))
64
    poi_geom = Column(Geometry('POINT, {}'.format(config.get_geo_default_projection())))
65
    original = Column(Unicode(128))
66
    poi_website = Column(Unicode(256))
67
    poi_description = Column(Unicode(1024))
68
    poi_fuel_adblue = Column(Boolean)
69
    poi_fuel_octane_100 = Column(Boolean)
70
    poi_fuel_octane_98 = Column(Boolean)
71
    poi_fuel_octane_95 = Column(Boolean)
72
    poi_fuel_diesel_gtl = Column(Boolean)
73
    poi_fuel_diesel = Column(Boolean)
74
    poi_fuel_lpg = Column(Boolean)
75
    poi_fuel_e85 = Column(Boolean)
76
    poi_rent_lpg_bottles = Column(Boolean)
77
    poi_compressed_air = Column(Boolean)
78
    poi_restaurant = Column(Boolean)
79
    poi_food = Column(Boolean)
80
    poi_truck = Column(Boolean)
81
    poi_ref = Column(Unicode(32))
82
    poi_phone = Column(Unicode(64))
83
    poi_email = Column(Unicode(64))
84
    poi_authentication_app = Column(Boolean)
85
    poi_authentication_none = Column(Boolean)
86
    poi_authentication_membership_card = Column(Boolean)
87
    poi_capacity = Column(Integer)
88
    poi_fee = Column(Boolean)
89
    poi_parking_fee = Column(Boolean)
90
    poi_motorcar = Column(Boolean)
91
    poi_socket_chademo = Column(Integer)
92
    poi_socket_chademo_output = Column(Unicode(16))
93
    poi_socket_type2_combo = Column(Integer)
94
    poi_socket_type2_combo_output = Column(Unicode(16))
95
    poi_socket_type2_cable = Column(Integer)
96
    poi_socket_type2_cable_output = Column(Unicode(16))
97
    poi_socket_type2 = Column(Integer)
98
    poi_socket_type2_output = Column(Unicode(16))
99
    poi_manufacturer = Column(Unicode(32))
100
    poi_model = Column(Unicode(32))
101
    poi_opening_hours_nonstop = Column(Boolean)
102
    poi_opening_hours_mo_open = Column(Time)
103
    poi_opening_hours_tu_open = Column(Time)
104
    poi_opening_hours_we_open = Column(Time)
105
    poi_opening_hours_th_open = Column(Time)
106
    poi_opening_hours_fr_open = Column(Time)
107
    poi_opening_hours_sa_open = Column(Time)
108
    poi_opening_hours_su_open = Column(Time)
109
    poi_opening_hours_mo_close = Column(Time)
110
    poi_opening_hours_tu_close = Column(Time)
111
    poi_opening_hours_we_close = Column(Time)
112
    poi_opening_hours_th_close = Column(Time)
113
    poi_opening_hours_fr_close = Column(Time)
114
    poi_opening_hours_sa_close = Column(Time)
115
    poi_opening_hours_su_close = Column(Time)
116
    poi_opening_hours_summer_mo_open = Column(Time)
117
    poi_opening_hours_summer_tu_open = Column(Time)
118
    poi_opening_hours_summer_we_open = Column(Time)
119
    poi_opening_hours_summer_th_open = Column(Time)
120
    poi_opening_hours_summer_fr_open = Column(Time)
121
    poi_opening_hours_summer_sa_open = Column(Time)
122
    poi_opening_hours_summer_su_open = Column(Time)
123
    poi_opening_hours_summer_mo_close = Column(Time)
124
    poi_opening_hours_summer_tu_close = Column(Time)
125
    poi_opening_hours_summer_we_close = Column(Time)
126
    poi_opening_hours_summer_th_close = Column(Time)
127
    poi_opening_hours_summer_fr_close = Column(Time)
128
    poi_opening_hours_summer_sa_close = Column(Time)
129
    poi_opening_hours_summer_su_close = Column(Time)
130
    poi_opening_hours_lunch_break_start = Column(Time)
131
    poi_opening_hours_lunch_break_stop = Column(Time)
132
    poi_public_holiday_open = Column(Boolean)
133
    poi_opening_hours = Column(Unicode(256), nullable=True, unique=False, index=True)
134
    poi_good = Column(JSON, nullable=True, index=False)
135
    poi_bad = Column(JSON, nullable=True, index=False)
136
    poi_hash = Column(Unicode(128), nullable=True, unique=False, index=True)
137
    poi_created = Column(DateTime(True), nullable=False, server_default=func.now())
138
    poi_updated = Column(DateTime(True))
139
    poi_deleted = Column(DateTime(True))
140
141
    common = relationship('POI_common', primaryjoin='POI_address.poi_common_id == POI_common.pc_id',
142
                          backref='poi_address')
143
    city = relationship('City', primaryjoin='POI_address.poi_addr_city == City.city_id', backref='poi_address')
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (111/100).

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

Loading history...
144
145
    # def __repr__(self):
146
    #  return '<POI address {}: {}>'.format(self.pa_id, self.poi_name)
147
148
149
class POI_common(Base):
0 ignored issues
show
Coding Style Naming introduced by
Class name "POI_common" doesn't conform to PascalCase naming style ('[^\\W\\da-z][^\\W_]+$' 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 class docstring
Loading history...
150
    __tablename__ = 'poi_common'
151
    _plural_name_ = 'poi_common'
152
    pc_id = Column(Integer, primary_key=True, index=True)
153
    id = synonym('pc_id')
154
    poi_name = Column(Unicode(64), unique=False, nullable=False, index=True)
155
    poi_type = Column(Enum(POI_type))
156
    poi_tags = Column(JSON, nullable=False, index=False)
157
    poi_url_base = Column(Unicode(32))
158
    poi_code = Column(Unicode(10), unique=True, nullable=False, index=True)
159
    poi_search_name = Column(Unicode(64))
160
    preserve_original_name = Column(Boolean, nullable=False, default=False)
161
    preserve_original_post_code = Column(Boolean, nullable=False, default=False)
162
    osm_search_distance_perfect = Column(Integer, nullable=True, index=False)
163
    osm_search_distance_safe = Column(Integer, nullable=True, index=False)
164
    osm_search_distance_unsafe = Column(Integer, nullable=True, index=False)
165
166
    def __repr__(self):
167
        return '<POI common {}: {}>'.format(self.pc_id, self.poi_name)
168
169
170
class POI_OSM_cache(Base):
0 ignored issues
show
Coding Style Naming introduced by
Class name "POI_OSM_cache" doesn't conform to PascalCase naming style ('[^\\W\\da-z][^\\W_]+$' 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 class docstring
Loading history...
171
    __tablename__ = 'poi_osm_cache'
172
    _plural_name_ = 'poi_osm_cache'
173
    poc_id = Column(Integer, primary_key=True, index=True)
174
    id = synonym('poc_id')
175
    # poi_type = Column(Enum(POI_type))
176
    osm_id = Column(BigInteger, nullable=False, index=True)
177
    osm_object_type = Column(Enum(OSM_object_type))
178
    osm_version = Column(Integer, nullable=False, index=True)
179
    osm_user = Column(Unicode(64), nullable=True, index=False)
180
    osm_user_id = Column(Integer, nullable=True, index=True)
181
    osm_changeset = Column(Integer, nullable=False, index=True)
182
    osm_timestamp = Column(DateTime(True), nullable=False)
183
    osm_lat = Column(Float, nullable=True, index=True)
184
    osm_lon = Column(Float, nullable=True, index=True)
185
    osm_nodes = Column(JSON, nullable=True, index=False)
186
    # osm_distance = Column(Integer, nullable=True, index=False)
187
    osm_live_tags = Column(JSON, nullable=True, index=False)
188
189
190
class City(Base):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
191
    __tablename__ = 'city'
192
    _plural_name_ = 'city'
193
    city_id = Column(Integer, primary_key=True, index=True)
194
    id = synonym('city_id')
195
    city_name = Column(Unicode)
196
    city_post_code = Column(Integer)
197
198
    __table_args__ = (UniqueConstraint('city_name', 'city_post_code', name='uc_city_name_post_code'),)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (102/100).

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

Loading history...
199
200
    def __repr__(self):
201
        return '<City {}: {} ({})>'.format(self.city_id, self.city_name, self.city_post_code)
202
203
204
class Street_type(Base):
0 ignored issues
show
Coding Style Naming introduced by
Class name "Street_type" doesn't conform to PascalCase naming style ('[^\\W\\da-z][^\\W_]+$' 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 class docstring
Loading history...
205
    __tablename__ = 'street_type'
206
    _plural_name_ = 'street_type'
207
    st_id = Column(Integer, primary_key=True, index=True)
208
    id = synonym('st_id')
209
    street_type = Column(Unicode(20))
210
211
    def __repr__(self):
212
        return '<Street type {}: {}>'.format(self.st_id, self.street_type)
213
214
215
class POI_osm(Base):
0 ignored issues
show
Coding Style Naming introduced by
Class name "POI_osm" doesn't conform to PascalCase naming style ('[^\\W\\da-z][^\\W_]+$' 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 class docstring
Loading history...
216
    __tablename__ = 'poi_osm'
217
    _plural_name_ = 'poi_osm'
218
    po_id = Column(Integer, primary_key=True, index=True)
219
    id = synonym('po_id')
220
    poi_osm_id = Column(BigInteger, unique=True, index=True)
221
    poi_osm_object_type = Column(Enum(OSM_object_type))
222
    poi_hash = Column(Unicode(128), nullable=True, unique=False, index=True)
223
    geom_hint = Column(Geometry('POINT, {}'.format(config.get_geo_default_projection())))
224
225
    __table_args__ = (UniqueConstraint('poi_osm_id', 'poi_osm_object_type', name='uc_poi_osm_osm_type'),)
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...
226