Passed
Push — master ( 795c0e...a7e03b )
by KAMI
02:44
created

POIDataset.lon()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
# -*- coding: utf-8 -*-
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
__author__ = 'kami911'
3
4
try:
5
    import logging
6
    import sys
7
    import pandas as pd
8
    from osm_poi_matchmaker.utils.enums import WeekDaysShort, OpenClose
9
    from osm_poi_matchmaker.libs.opening_hours import OpeningHours
10
    from osm_poi_matchmaker.libs.geo import check_geom
11
    from osm_poi_matchmaker.libs.address import clean_string, clean_url, clean_branch
12
    from osm_poi_matchmaker.dao import poi_array_structure
13
    from osm_poi_matchmaker.utils import config
14
    from osm_poi_matchmaker.dao.poi_base import POIBase
15
    from osm_poi_matchmaker.libs.poi_qc import POIQC
16
except ImportError as err:
17
    logging.error('Error %s import module: %s', module=__name__, error=err)
18
    logging.exception('Exception occurred')
19
20
    sys.exit(128)
21
22
__program__ = 'poi_dataset'
23
__version__ = '0.0.5'
24
25
POI_COLS = poi_array_structure.POI_COLS
26
27
28
class POIDataset:
0 ignored issues
show
best-practice introduced by
Too many instance attributes (71/7)
Loading history...
best-practice introduced by
Too many public methods (94/20)
Loading history...
29
    """Contains all handled OSM tags
30
    """    
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
31
    def __init__(self):
32
        """
33
        """        
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
34
        self.insert_data = []
35
        self.__db = POIBase(
36
            '{}://{}:{}@{}:{}/{}'.format(config.get_database_type(), config.get_database_writer_username(),
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (107/100).

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

Loading history...
37
                                         config.get_database_writer_password(),
38
                                         config.get_database_writer_host(),
39
                                         config.get_database_writer_port(),
40
                                         config.get_database_poi_database()))
41
        self.__code = None
42
        self.__postcode = None
43
        self.__city = None
44
        self.__name = None
45
        self.__branch = None
46
        self.__website = None
47
        self.__description = None
48
        self.__fuel_adblue = None
49
        self.__fuel_octane_100 = None
50
        self.__fuel_octane_98 = None
51
        self.__fuel_octane_95 = None
52
        self.__fuel_diesel_gtl = None
53
        self.__fuel_diesel = None
54
        self.__fuel_lpg = None
55
        self.__fuel_e85 = None
56
        self.__rent_lpg_bottles = None
57
        self.__compressed_air = None
58
        self.__restaurant = None
59
        self.__food = None
60
        self.__truck = None
61
        self.__authentication_app = None
62
        self.__authentication_membership_card = None
63
        self.__capacity = None
64
        self.__fee = None
65
        self.__parking_fee = None
66
        self.__motorcar = None
67
        self.__socket_chademo = None
68
        self.__socket_chademo_output = None
69
        self.__socket_type2_combo = None
70
        self.__socket_type2_combo_output = None
71
        self.__socket_type2_cable = None
72
        self.__socket_type2_cable_output = None
73
        self.__socket_type2 = None
74
        self.__socket_type2_output = None
75
        self.__manufacturer = None
76
        self.__model = None
77
        self.__original = None
78
        self.__street = None
79
        self.__housenumber = None
80
        self.__conscriptionnumber = None
81
        self.__ref = None
82
        self.__phone = None
83
        self.__email = None
84
        self.__geom = None
85
        self.__lat = None
86
        self.__lon = None
87
        self.__nonstop = None
88
        self.__oh = pd.DataFrame(index=WeekDaysShort, columns=OpenClose)
89
        self.__lunch_break = {'start': None, 'stop': None}
90
        self.__opening_hours = None
91
        self.__public_holiday_open = None
92
        self.__good = []
93
        self.__bad = []
94
95
    def clear_all(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
96
        self.__code = None
97
        self.__postcode = None
98
        self.__city = None
99
        self.__name = None
100
        self.__branch = None
101
        self.__website = None
102
        self.__description = None
103
        self.__fuel_adblue = None
104
        self.__fuel_octane_100 = None
105
        self.__fuel_octane_98 = None
106
        self.__fuel_octane_95 = None
107
        self.__fuel_diesel_gtl = None
108
        self.__fuel_diesel = None
109
        self.__fuel_lpg = None
110
        self.__fuel_e85 = None
111
        self.__rent_lpg_bottles = None
112
        self.__compressed_air = None
113
        self.__restaurant = None
114
        self.__food = None
115
        self.__truck = None
116
        self.__authentication_app = None
117
        self.__authentication_membership_card = None
118
        self.__capacity = None
119
        self.__fee = None
120
        self.__parking_fee = None
121
        self.__motorcar = None
122
        self.__socket_chademo = None
123
        self.__socket_chademo_output = None
124
        self.__socket_type2_combo = None
125
        self.__socket_type2_combo_output = None
126
        self.__socket_type2_cable = None
127
        self.__socket_type2_cable_output = None
128
        self.__socket_type2 = None
129
        self.__socket_type2_output = None
130
        self.__manufacturer = None
131
        self.__model = None
132
        self.__original = None
133
        self.__street = None
134
        self.__housenumber = None
135
        self.__conscriptionnumber = None
136
        self.__ref = None
137
        self.__phone = None
138
        self.__email = None
139
        self.__geom = None
140
        self.__lat = None
141
        self.__lon = None
142
        self.__nonstop = None
143
        self.__oh = pd.DataFrame(index=WeekDaysShort, columns=OpenClose)
144
        self.__lunch_break = {'start': None, 'stop': None}
145
        self.__opening_hours = None
146
        self.__public_holiday_open = None
147
        self.__good = []
148
        self.__bad = []
149
150
    @property
151
    def code(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
152
        return self.__code
153
154
    @code.setter
155
    def code(self, data: str):
156
        self.__code = data
157
158
    @property
159
    def postcode(self) -> int:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
160
        return self.__postcode
161
162
    @postcode.setter
163
    def postcode(self, data: int):
164
        self.__postcode = data
165
166
    @property
167
    def city(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
168
        return self.__city
169
170
    @city.setter
171
    def city(self, data: str):
172
        self.__city = data
173
174
    @property
175
    def name(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
176
        return self.__name
177
178
    @name.setter
179
    def name(self, data: str):
180
        self.__name = data
181
182
    @property
183
    def branch(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
184
        return self.__branch
185
186
    @branch.setter
187
    def branch(self, data: str):
188
        self.__branch = clean_branch(data)
189
190
    @property
191
    def website(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
192
        return self.__website
193
194
    @website.setter
195
    def website(self, data: str):
196
        self.__website = clean_url(data)
197
198
    @property
199
    def description(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
200
        return self.__description
201
202
    @description.setter
203
    def description(self, data: str):
204
        self.__description = data
205
206
    @property
207
    def fuel_adblue(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
208
        return self.__fuel_adblue
209
210
    @fuel_adblue.setter
211
    def fuel_adblue(self, data: bool):
212
        self.__fuel_adblue = data
213
214
    @property
215
    def fuel_octane_100(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
216
        return self.__fuel_octane_100
217
218
    @fuel_octane_100.setter
219
    def fuel_octane_100(self, data: bool):
220
        self.__fuel_octane_100 = data
221
222
    @property
223
    def fuel_octane_98(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
224
        return self.__fuel_octane_98
225
226
    @fuel_octane_98.setter
227
    def fuel_octane_98(self, data: bool):
228
        self.__fuel_octane_98 = data
229
230
    @property
231
    def fuel_octane_95(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
232
        return self.__fuel_octane_95
233
234
    @fuel_octane_95.setter
235
    def fuel_octane_95(self, data: bool):
236
        self.__fuel_octane_95 = data
237
238
    @property
239
    def fuel_diesel_gtl(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
240
        return self.__fuel_diesel_gtl
241
242
    @fuel_diesel_gtl.setter
243
    def fuel_diesel_gtl(self, data: bool):
244
        self.__fuel_diesel_gtl = data
245
246
    @property
247
    def fuel_diesel(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
248
        return self.__fuel_diesel
249
250
    @fuel_diesel.setter
251
    def fuel_diesel(self, data: bool):
252
        self.__fuel_diesel = data
253
254
    @property
255
    def fuel_lpg(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
256
        return self.__fuel_lpg
257
258
    @fuel_lpg.setter
259
    def fuel_lpg(self, data: bool):
260
        self.__fuel_lpg = data
261
262
    @property
263
    def fuel_e85(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
264
        return self.__fuel_e85
265
266
    @fuel_e85.setter
267
    def fuel_e85(self, data: bool):
268
        self.__fuel_e85 = data
269
270
    @property
271
    def rent_lpg_bottles(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
272
        return self.__rent_lpg_bottles
273
274
    @rent_lpg_bottles.setter
275
    def rent_lpg_bottles(self, data: bool):
276
        self.__rent_lpg_bottles = data
277
278
    @property
279
    def compressed_air(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
280
        return self.__compressed_air
281
282
    @compressed_air.setter
283
    def compressed_air(self, data: bool):
284
        self.__compressed_air = data
285
286
    @property
287
    def restaurant(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
288
        return self.__restaurant
289
290
    @restaurant.setter
291
    def restaurant(self, data: bool):
292
        self.__restaurant = data
293
294
    @property
295
    def food(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
296
        return self.__food
297
298
    @food.setter
299
    def food(self, data: bool):
300
        self.__food = data
301
302
    @property
303
    def truck(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
304
        return self.__truck
305
306
    @truck.setter
307
    def truck(self, data: bool):
308
        self.__truck = data
309
310
    @property
311
    def authentication_app(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
312
        return self.__authentication_app
313
314
    @authentication_app.setter
315
    def authentication_app(self, data: bool):
316
        self.__authentication_app = data
317
318
    @property
319
    def authentication_membership_card(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
320
        return self.__authentication_membership_card
321
322
    @authentication_membership_card.setter
323
    def authentication_membership_card(self, data: bool):
324
        self.__authentication_membership_card = data
325
326
    @property
327
    def capacity(self) -> int:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
328
        return self.__capacity
329
330
    @capacity.setter
331
    def capacity(self, data: int):
332
        self.__capacity = data
333
334
    @property
335
    def fee(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
336
        return self.__fee
337
338
    @fee.setter
339
    def fee(self, data: bool):
340
        self.__fee = data
341
342
    @property
343
    def parking_fee(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
344
        return self.__parking_fee
345
346
    @parking_fee.setter
347
    def parking_fee(self, data: bool):
348
        self.__parking_fee = data
349
350
    @property
351
    def motorcar(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
352
        return self.__motorcar
353
354
    @motorcar.setter
355
    def motorcar(self, data: bool):
356
        self.__motorcar = data
357
358
    @property
359
    def socket_chademo(self) -> int:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
360
        return self.__socket_chademo
361
362
    @socket_chademo.setter
363
    def socket_chademo(self, data: int):
364
        self.__socket_chademo = data
365
366
    @property
367
    def socket_chademo_output(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
368
        return self.__socket_chademo_output
369
370
    @socket_chademo_output.setter
371
    def socket_chademo_output(self, data: str):
372
        self.__socket_chademo_output = data
373
374
    @property
375
    def socket_type2_combo(self) -> int:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
376
        return self.__socket_type2_combo
377
378
    @socket_type2_combo.setter
379
    def socket_type2_combo(self, data: int):
380
        self.__socket_type2_combo = data
381
382
    @property
383
    def socket_type2_combo_output(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
384
        return self.__socket_type2_combo_output
385
386
    @socket_type2_combo_output.setter
387
    def socket_type2_combo_output(self, data: str):
388
        self.__socket_type2_combo_output = data
389
390
    @property
391
    def socket_type2_cable(self) -> int:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
392
        return self.__socket_type2_cable
393
394
    @socket_type2_cable.setter
395
    def socket_type2_cable(self, data: int):
396
        self.__socket_type2_cable = data
397
398
    @property
399
    def socket_type2_cable_output(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
400
        return self.__socket_type2_cable_output
401
402
    @socket_type2_cable_output.setter
403
    def socket_type2_cable_output(self, data: str):
404
        self.__socket_type2_cable_output = data
405
406
    @property
407
    def socket_type2(self) -> int:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
408
        return self.__socket_type2
409
410
    @socket_type2.setter
411
    def socket_type2(self, data: int):
412
        self.__socket_type2 = data
413
414
    @property
415
    def socket_type2_output(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
416
        return self.__socket_type2_output
417
418
    @socket_type2_output.setter
419
    def socket_type2_output(self, data: str):
420
        self.__socket_type2_output = data
421
422
    @property
423
    def manufacturer(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
424
        return self.__manufacturer
425
426
    @manufacturer.setter
427
    def manufacturer(self, data: str):
428
        self.__manufacturer = data
429
430
    @property
431
    def model(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
432
        return self.__model
433
434
    @model.setter
435
    def model(self, data: str):
436
        self.__model = data
437
438
    @property
439
    def original(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
440
        return self.__original
441
442
    @original.setter
443
    def original(self, data: str):
444
        self.__original = data
445
446
    @property
447
    def street(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
448
        return self.__street
449
450
    @street.setter
451
    def street(self, data: str):
452
        # Try to find street name around
453
        try:
454
            if self.lat is not None and self.lon is not None:
455
                query = self.__db.query_name_road_around(self.lon, self.lat, data, True, 'name')
456
                if query is None or query.empty:
457
                    query = self.__db.query_name_road_around(self.lon, self.lat, data, True, 'metaphone')
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...
458
                    if query is None or query.empty:
459
                        logging.warning('There is no street around named or metaphone named: %s', data)
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...
460
                        self.__street = data
461
                    else:
462
                        new_data = query.at[0, 'name']
463
                        logging.info('There is a metaphone street around named: %s, original was: %s.', new_data, data)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (119/100).

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

Loading history...
464
                        self.__street = new_data
465
                else:
466
                    logging.info('There is a street around named: %s.', data)
467
                    self.__street = data
468
            else:
469
                self.__street = data
470
        except Exception as e:
0 ignored issues
show
Best Practice introduced by
Catching very general exceptions such as Exception is usually not recommended.

Generally, you would want to handle very specific errors in the exception handler. This ensure that you do not hide other types of errors which should be fixed.

So, unless you specifically plan to handle any error, consider adding a more specific exception.

Loading history...
Coding Style Naming introduced by
Variable name "e" 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...
471
            logging.error(e)
472
            logging.exception('Exception occurred')
473
474
    @property
475
    def housenumber(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
476
        return self.__housenumber
477
478
    @housenumber.setter
479
    def housenumber(self, data: str):
480
        self.__housenumber = data
481
482
    @property
483
    def conscriptionnumber(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
484
        return self.__conscriptionnumber
485
486
    @conscriptionnumber.setter
487
    def conscriptionnumber(self, data: str):
488
        self.__conscriptionnumber = data
489
490
    @property
491
    def ref(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
492
        return self.__ref
493
494
    @ref.setter
495
    def ref(self, data: str):
496
        self.__ref = data
497
498
    @property
499
    def phone(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
500
        return self.__phone
501
502
    @phone.setter
503
    def phone(self, data: str):
504
        if data == 'NULL':
505
            self.__phone = None
506
        else:
507
            self.__phone = data
508
509
    @property
510
    def email(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
511
        return self.__email
512
513
    @email.setter
514
    def email(self, data: str):
515
        if data == 'NULL':
516
            self.__email = None
517
        else:
518
            self.__email = data
519
520
    @property
521
    def geom(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
522
        return self.__geom
523
524
    @geom.setter
525
    def geom(self, data: str):
526
        self.__geom = data
527
528
    @property
529
    def lat(self) -> float:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
530
        return self.__lat
531
532
    @lat.setter
533
    def lat(self, lat: float):
534
        self.__lat = lat
535
536
    @property
537
    def lon(self) -> float:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
538
        return self.__lon
539
540
    @lon.setter
541
    def lon(self, lon: float):
542
        self.__lon = lon
543
544
    def process_geom(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
545
        self.geom = check_geom(self.__lat, self.__lon)
546
547
    @property
548
    def opening_hours_table(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
549
        return self.__oh
550
551
    @opening_hours_table.setter
552
    def opening_hours_table(self, data):
553
        self.__oh = pd.DataFrame(data, index=WeekDaysShort, columns=OpenClose)
554
555
    @property
556
    def nonstop(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
557
        return self.__nonstop
558
559
    @nonstop.setter
560
    def nonstop(self, data: bool):
561
        self.__nonstop = data
562
563
    @property
564
    def mo_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
565
        return self.__oh.at[WeekDaysShort.mo, OpenClose.open]
566
567
    @mo_o.setter
568
    def mo_o(self, data: str):
569
        self.__oh.at[WeekDaysShort.mo, OpenClose.open] = data
570
571
    @property
572
    def tu_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
573
        return self.__oh.at[WeekDaysShort.tu, OpenClose.open]
574
575
    @tu_o.setter
576
    def tu_o(self, data: str):
577
        self.__oh.at[WeekDaysShort.tu, OpenClose.open] = data
578
579
    @property
580
    def we_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
581
        return self.__oh.at[WeekDaysShort.we, OpenClose.open]
582
583
    @we_o.setter
584
    def we_o(self, data: str):
585
        self.__oh.at[WeekDaysShort.we, OpenClose.open] = data
586
587
    @property
588
    def th_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
589
        return self.__oh.at[WeekDaysShort.th, OpenClose.open]
590
591
    @th_o.setter
592
    def th_o(self, data: str):
593
        self.__oh.at[WeekDaysShort.th, OpenClose.open] = data
594
595
    @property
596
    def fr_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
597
        return self.__oh.at[WeekDaysShort.fr, OpenClose.open]
598
599
    @fr_o.setter
600
    def fr_o(self, data: str):
601
        self.__oh.at[WeekDaysShort.fr, OpenClose.open] = data
602
603
    @property
604
    def sa_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
605
        return self.__oh.at[WeekDaysShort.sa, OpenClose.open]
606
607
    @sa_o.setter
608
    def sa_o(self, data: str):
609
        self.__oh.at[WeekDaysShort.sa, OpenClose.open] = data
610
611
    @property
612
    def su_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
613
        return self.__oh.at[WeekDaysShort.su, OpenClose.open]
614
615
    @su_o.setter
616
    def su_o(self, data: str):
617
        self.__oh.at[WeekDaysShort.su, OpenClose.open] = data
618
619
    @property
620
    def mo_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
621
        return self.__oh.at[WeekDaysShort.mo, OpenClose.close]
622
623
    @mo_c.setter
624
    def mo_c(self, data: str):
625
        self.__oh.at[WeekDaysShort.mo, OpenClose.close] = data
626
627
    @property
628
    def tu_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
629
        return self.__oh.at[WeekDaysShort.tu, OpenClose.close]
630
631
    @tu_c.setter
632
    def tu_c(self, data: str):
633
        self.__oh.at[WeekDaysShort.tu, OpenClose.close] = data
634
635
    @property
636
    def we_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
637
        return self.__oh.at[WeekDaysShort.we, OpenClose.close]
638
639
    @we_c.setter
640
    def we_c(self, data: str):
641
        self.__oh.at[WeekDaysShort.we, OpenClose.close] = data
642
643
    @property
644
    def th_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
645
        return self.__oh.at[WeekDaysShort.th, OpenClose.close]
646
647
    @th_c.setter
648
    def th_c(self, data: str):
649
        self.__oh.at[WeekDaysShort.th, OpenClose.close] = data
650
651
    @property
652
    def fr_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
653
        return self.__oh.at[WeekDaysShort.fr, OpenClose.close]
654
655
    @fr_c.setter
656
    def fr_c(self, data: str):
657
        self.__oh.at[WeekDaysShort.fr, OpenClose.close] = data
658
659
    @property
660
    def sa_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
661
        return self.__oh.at[WeekDaysShort.sa, OpenClose.close]
662
663
    @sa_c.setter
664
    def sa_c(self, data: str):
665
        self.__oh.at[WeekDaysShort.sa, OpenClose.close] = data
666
667
    @property
668
    def su_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
669
        return self.__oh.at[WeekDaysShort.su, OpenClose.close]
670
671
    @su_c.setter
672
    def su_c(self, data: str):
673
        self.__oh.at[WeekDaysShort.su, OpenClose.close] = data
674
675
    @property
676
    def summer_mo_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
677
        return self.__oh.at[WeekDaysShort.mo, OpenClose.summer_open]
678
679
    @summer_mo_o.setter
680
    def summer_mo_o(self, data: str):
681
        self.__oh.at[WeekDaysShort.mo, OpenClose.summer_open] = data
682
683
    @property
684
    def summer_tu_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
685
        return self.__oh.at[WeekDaysShort.tu, OpenClose.summer_open]
686
687
    @summer_tu_o.setter
688
    def summer_tu_o(self, data: str):
689
        self.__oh.at[WeekDaysShort.tu, OpenClose.summer_open] = data
690
691
    @property
692
    def summer_we_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
693
        return self.__oh.at[WeekDaysShort.we, OpenClose.summer_open]
694
695
    @summer_we_o.setter
696
    def summer_we_o(self, data: str):
697
        self.__oh.at[WeekDaysShort.we, OpenClose.summer_open] = data
698
699
    @property
700
    def summer_th_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
701
        return self.__oh.at[WeekDaysShort.th, OpenClose.summer_open]
702
703
    @summer_th_o.setter
704
    def summer_th_o(self, data: str):
705
        self.__oh.at[WeekDaysShort.th, OpenClose.summer_open] = data
706
707
    @property
708
    def summer_fr_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
709
        return self.__oh.at[WeekDaysShort.fr, OpenClose.summer_open]
710
711
    @summer_fr_o.setter
712
    def summer_fr_o(self, data: str):
713
        self.__oh.at[WeekDaysShort.fr, OpenClose.summer_open] = data
714
715
    @property
716
    def summer_sa_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
717
        return self.__oh.at[WeekDaysShort.sa, OpenClose.summer_open]
718
719
    @summer_sa_o.setter
720
    def summer_sa_o(self, data: str):
721
        self.__oh.at[WeekDaysShort.sa, OpenClose.summer_open] = data
722
723
    @property
724
    def summer_su_o(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
725
        return self.__oh.at[WeekDaysShort.su, OpenClose.summer_open]
726
727
    @summer_su_o.setter
728
    def summer_su_o(self, data: str):
729
        self.__oh.at[WeekDaysShort.su, OpenClose.summer_open] = data
730
731
    @property
732
    def summer_mo_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
733
        return self.__oh.at[WeekDaysShort.mo, OpenClose.summer_close]
734
735
    @summer_mo_c.setter
736
    def summer_mo_c(self, data: str):
737
        self.__oh.at[WeekDaysShort.mo, OpenClose.summer_close] = data
738
739
    @property
740
    def summer_tu_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
741
        return self.__oh.at[WeekDaysShort.tu, OpenClose.summer_close]
742
743
    @summer_tu_c.setter
744
    def summer_tu_c(self, data: str):
745
        self.__oh.at[WeekDaysShort.tu, OpenClose.summer_close] = data
746
747
    @property
748
    def summer_we_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
749
        return self.__oh.at[WeekDaysShort.we, OpenClose.summer_close]
750
751
    @summer_we_c.setter
752
    def summer_we_c(self, data: str):
753
        self.__oh.at[WeekDaysShort.we, OpenClose.summer_close] = data
754
755
    @property
756
    def summer_th_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
757
        return self.__oh.at[WeekDaysShort.th, OpenClose.summer_close]
758
759
    @summer_th_c.setter
760
    def summer_th_c(self, data: str):
761
        self.__oh.at[WeekDaysShort.th, OpenClose.summer_close] = data
762
763
    @property
764
    def summer_fr_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
765
        return self.__oh.at[WeekDaysShort.fr, OpenClose.summer_close]
766
767
    @summer_fr_c.setter
768
    def summer_fr_c(self, data: str):
769
        self.__oh.at[WeekDaysShort.fr, OpenClose.summer_close] = data
770
771
    @property
772
    def summer_sa_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
773
        return self.__oh.at[WeekDaysShort.sa, OpenClose.summer_close]
774
775
    @summer_sa_c.setter
776
    def summer_sa_c(self, data: str):
777
        self.__oh.at[WeekDaysShort.sa, OpenClose.summer_close] = data
778
779
    @property
780
    def summer_su_c(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
781
        return self.__oh.at[WeekDaysShort.su, OpenClose.summer_close]
782
783
    @summer_su_c.setter
784
    def summer_su_c(self, data: str):
785
        self.__oh.at[WeekDaysShort.su, OpenClose.summer_close] = data
786
787
    @property
788
    def lunch_break(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
789
        return self.__lunch_break['start'], self.__lunch_break['stop']
790
791
    @lunch_break.setter
792
    def lunch_break(self, lunch_break_start: str, lunch_break_stop: str):
793
        self.__lunch_break = {'start': lunch_break_start, 'stop': lunch_break_stop}
794
795
    @property
796
    def lunch_break_start(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
797
        return self.__lunch_break['start']
798
799
    @lunch_break_start.setter
800
    def lunch_break_start(self, data: str):
801
        self.__lunch_break['start'] = data
802
803
    @property
804
    def lunch_break_stop(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
805
        return self.__lunch_break['stop']
806
807
    @lunch_break_stop.setter
808
    def lunch_break_stop(self, data: str):
809
        self.__lunch_break['stop'] = data
810
811
    def day_open(self, day, data):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
812
        self.__oh.at[WeekDaysShort(day), OpenClose.open] = data
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable WeekDaysShort does not seem to be defined.
Loading history...
813
814
    def day_close(self, day, data):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
815
        self.__oh.at[WeekDaysShort(day), OpenClose.close] = data
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable WeekDaysShort does not seem to be defined.
Loading history...
816
817
    def day_summer_open(self, day, data):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
818
        self.__oh.at[WeekDaysShort(day), OpenClose.summer_open] = data
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable WeekDaysShort does not seem to be defined.
Loading history...
819
820
    def day_summer_close(self, day, data):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
821
        self.__oh.at[WeekDaysShort(day), OpenClose.summer_close] = data
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable WeekDaysShort does not seem to be defined.
Loading history...
822
823
    def day_open_close(self, day, opening, closing):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
824
        self.__oh.at[WeekDaysShort(day), OpenClose.open] = opening
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable WeekDaysShort does not seem to be defined.
Loading history...
825
        self.__oh.at[WeekDaysShort(day), OpenClose.close] = closing
826
827
    def day_summer_open_close(self, day, opening, closing):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
828
        self.__oh.at[WeekDaysShort(day), OpenClose.summer_open] = opening
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable WeekDaysShort does not seem to be defined.
Loading history...
829
        self.__oh.at[WeekDaysShort(day), OpenClose.summer_close] = closing
830
831
    @property
832
    def opening_hours(self) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
833
        return self.__opening_hours
834
835
    @opening_hours.setter
836
    def opening_hours(self, data: str):
837
        self.__opening_hours = data
838
839
    @property
840
    def public_holiday_open(self) -> bool:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
841
        return self.__public_holiday_open
842
843
    @public_holiday_open.setter
844
    def public_holiday_open(self, data: bool):
845
        self.__public_holiday_open = data
846
847
    def process_opening_hours(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
848
        self.__oh = self.__oh.where((pd.notnull(self.__oh)), None)
849
        t = OpeningHours(self.__nonstop, self.__oh.at[WeekDaysShort.mo, OpenClose.open],
0 ignored issues
show
Coding Style Naming introduced by
Variable name "t" 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...
850
                         self.__oh.at[WeekDaysShort.tu, OpenClose.open],
851
                         self.__oh.at[WeekDaysShort.we, OpenClose.open],
852
                         self.__oh.at[WeekDaysShort.th, OpenClose.open],
853
                         self.__oh.at[WeekDaysShort.fr, OpenClose.open],
854
                         self.__oh.at[WeekDaysShort.sa, OpenClose.open],
855
                         self.__oh.at[WeekDaysShort.su, OpenClose.open],
856
                         self.__oh.at[WeekDaysShort.mo, OpenClose.close],
857
                         self.__oh.at[WeekDaysShort.tu, OpenClose.close],
858
                         self.__oh.at[WeekDaysShort.we, OpenClose.close],
859
                         self.__oh.at[WeekDaysShort.th, OpenClose.close],
860
                         self.__oh.at[WeekDaysShort.fr, OpenClose.close],
861
                         self.__oh.at[WeekDaysShort.sa, OpenClose.close],
862
                         self.__oh.at[WeekDaysShort.su, OpenClose.close],
863
                         self.__oh.at[WeekDaysShort.mo, OpenClose.summer_open],
864
                         self.__oh.at[WeekDaysShort.tu, OpenClose.summer_open],
865
                         self.__oh.at[WeekDaysShort.we, OpenClose.summer_open],
866
                         self.__oh.at[WeekDaysShort.th, OpenClose.summer_open],
867
                         self.__oh.at[WeekDaysShort.fr, OpenClose.summer_open],
868
                         self.__oh.at[WeekDaysShort.sa, OpenClose.summer_open],
869
                         self.__oh.at[WeekDaysShort.su, OpenClose.summer_open],
870
                         self.__oh.at[WeekDaysShort.mo, OpenClose.summer_close],
871
                         self.__oh.at[WeekDaysShort.tu, OpenClose.summer_close],
872
                         self.__oh.at[WeekDaysShort.we, OpenClose.summer_close],
873
                         self.__oh.at[WeekDaysShort.th, OpenClose.summer_close],
874
                         self.__oh.at[WeekDaysShort.fr, OpenClose.summer_close],
875
                         self.__oh.at[WeekDaysShort.sa, OpenClose.summer_close],
876
                         self.__oh.at[WeekDaysShort.su, OpenClose.summer_close],
877
                         self.__lunch_break['start'], self.__lunch_break['stop'],
878
                         self.__public_holiday_open)
879
        self.__opening_hours = t.process()
880
881
    def dump_opening_hours(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
882
        print(self.__opening_hours)
883
884
    def add(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
885
        try:
886
            self.process_opening_hours()
887
            self.process_geom()
888
            pqc = POIQC(self.__db, self.__lon, self.__lat, self.__opening_hours, self.__street)
889
            self.__good, self.__bad = pqc.process()
890
            self.insert_data.append(
891
                [self.__code, self.__postcode, self.__city, self.__name, clean_string(self.__branch), self.__website,
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (117/100).

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

Loading history...
892
                 self.__description, self.__fuel_adblue, self.__fuel_octane_100, self.__fuel_octane_98,
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...
893
                 self.__fuel_octane_95, self.__fuel_diesel_gtl, self.__fuel_diesel, self.__fuel_lpg,
894
                 self.__fuel_e85, self.__rent_lpg_bottles, self.__compressed_air, self.__restaurant, self.__food,
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (113/100).

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

Loading history...
895
                 self.__truck,
896
                 self.__authentication_app, self.__authentication_membership_card, self.__capacity, self.__fee,
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...
897
                 self.__parking_fee, self.__motorcar, self.__socket_chademo, self.__socket_chademo_output,
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (106/100).

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

Loading history...
898
                 self.__socket_type2_combo, self.__socket_type2_combo_output,
899
                 self.__socket_type2_cable, self.__socket_type2_cable_output,
900
                 self.__socket_type2, self.__socket_type2_output, self.__manufacturer, self.__model,
901
                 self.__original, self.__street, self.__housenumber, self.__conscriptionnumber,
902
                 self.__ref, self.__phone, self.__email, self.__geom, self.__nonstop,
903
                 self.__oh.at[WeekDaysShort.mo, OpenClose.open],
904
                 self.__oh.at[WeekDaysShort.tu, OpenClose.open],
905
                 self.__oh.at[WeekDaysShort.we, OpenClose.open],
906
                 self.__oh.at[WeekDaysShort.th, OpenClose.open],
907
                 self.__oh.at[WeekDaysShort.fr, OpenClose.open],
908
                 self.__oh.at[WeekDaysShort.sa, OpenClose.open],
909
                 self.__oh.at[WeekDaysShort.su, OpenClose.open],
910
                 self.__oh.at[WeekDaysShort.mo, OpenClose.close],
911
                 self.__oh.at[WeekDaysShort.tu, OpenClose.close],
912
                 self.__oh.at[WeekDaysShort.we, OpenClose.close],
913
                 self.__oh.at[WeekDaysShort.th, OpenClose.close],
914
                 self.__oh.at[WeekDaysShort.fr, OpenClose.close],
915
                 self.__oh.at[WeekDaysShort.sa, OpenClose.close],
916
                 self.__oh.at[WeekDaysShort.su, OpenClose.close],
917
                 self.__oh.at[WeekDaysShort.mo, OpenClose.summer_open],
918
                 self.__oh.at[WeekDaysShort.tu, OpenClose.summer_open],
919
                 self.__oh.at[WeekDaysShort.we, OpenClose.summer_open],
920
                 self.__oh.at[WeekDaysShort.th, OpenClose.summer_open],
921
                 self.__oh.at[WeekDaysShort.fr, OpenClose.summer_open],
922
                 self.__oh.at[WeekDaysShort.sa, OpenClose.summer_open],
923
                 self.__oh.at[WeekDaysShort.su, OpenClose.summer_open],
924
                 self.__oh.at[WeekDaysShort.mo, OpenClose.summer_close],
925
                 self.__oh.at[WeekDaysShort.tu, OpenClose.summer_close],
926
                 self.__oh.at[WeekDaysShort.we, OpenClose.summer_close],
927
                 self.__oh.at[WeekDaysShort.th, OpenClose.summer_close],
928
                 self.__oh.at[WeekDaysShort.fr, OpenClose.summer_close],
929
                 self.__oh.at[WeekDaysShort.sa, OpenClose.summer_close],
930
                 self.__oh.at[WeekDaysShort.su, OpenClose.summer_close], self.__lunch_break['start'],
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (101/100).

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

Loading history...
931
                 self.__lunch_break['stop'],
932
                 self.__public_holiday_open, self.__opening_hours, self.__good, self.__bad])
933
            self.clear_all()
934
        except Exception as e:
0 ignored issues
show
Best Practice introduced by
Catching very general exceptions such as Exception is usually not recommended.

Generally, you would want to handle very specific errors in the exception handler. This ensure that you do not hide other types of errors which should be fixed.

So, unless you specifically plan to handle any error, consider adding a more specific exception.

Loading history...
Coding Style Naming introduced by
Variable name "e" 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...
935
            logging.error(e)
936
            logging.exception('Exception occurred')
937
938
    def process(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
939
        df = pd.DataFrame(self.insert_data)
0 ignored issues
show
Coding Style Naming introduced by
Variable name "df" 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...
940
        df.columns = POI_COLS
941
        return df.where((pd.notnull(df)), None)
942
943
    def lenght(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
944
        return len(self.insert_data)
945