Passed
Branch master (5cfa60)
by KAMI
02:31
created

POIDataset.add()   B

Complexity

Conditions 2

Size

Total Lines 52
Code Lines 52

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 52
nop 1
dl 0
loc 52
rs 8.5709
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
# -*- coding: utf-8 -*-
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
__author__ = 'kami911'
3
4
try:
5
    import traceback
6
    import logging
7
    import sys
8
    import pandas as pd
9
    from osm_poi_matchmaker.utils.enums import WeekDaysShort, OpenClose
10
    from osm_poi_matchmaker.libs.opening_hours import OpeningHours
11
    from osm_poi_matchmaker.libs.geo import check_geom
12
    from osm_poi_matchmaker.libs.address import clean_string, clean_url, clean_branch
13
    from osm_poi_matchmaker.dao import poi_array_structure
14
    from osm_poi_matchmaker.utils import config
15
    from osm_poi_matchmaker.dao.poi_base import POIBase
16
    from osm_poi_matchmaker.libs.poi_qc import POIQC
17
except ImportError as err:
18
    logging.error('Error {error} import module: {module}', module=__name__, error=err)
19
    logging.error(traceback.print_exc())
0 ignored issues
show
Bug introduced by
The Class traceback does not seem to have a member named print_exc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

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

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

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

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

Loading history...
877
                 self.__original, self.__street, self.__housenumber, self.__conscriptionnumber,
878
                 self.__ref, self.__phone, self.__email, self.__geom, self.__nonstop,
879
                 self.__oh.at[WeekDaysShort.mo, OpenClose.open],
880
                 self.__oh.at[WeekDaysShort.tu, OpenClose.open],
881
                 self.__oh.at[WeekDaysShort.we, OpenClose.open],
882
                 self.__oh.at[WeekDaysShort.th, OpenClose.open],
883
                 self.__oh.at[WeekDaysShort.fr, OpenClose.open],
884
                 self.__oh.at[WeekDaysShort.sa, OpenClose.open],
885
                 self.__oh.at[WeekDaysShort.su, OpenClose.open],
886
                 self.__oh.at[WeekDaysShort.mo, OpenClose.close],
887
                 self.__oh.at[WeekDaysShort.tu, OpenClose.close],
888
                 self.__oh.at[WeekDaysShort.we, OpenClose.close],
889
                 self.__oh.at[WeekDaysShort.th, OpenClose.close],
890
                 self.__oh.at[WeekDaysShort.fr, OpenClose.close],
891
                 self.__oh.at[WeekDaysShort.sa, OpenClose.close],
892
                 self.__oh.at[WeekDaysShort.su, OpenClose.close],
893
                 self.__oh.at[WeekDaysShort.mo, OpenClose.summer_open],
894
                 self.__oh.at[WeekDaysShort.tu, OpenClose.summer_open],
895
                 self.__oh.at[WeekDaysShort.we, OpenClose.summer_open],
896
                 self.__oh.at[WeekDaysShort.th, OpenClose.summer_open],
897
                 self.__oh.at[WeekDaysShort.fr, OpenClose.summer_open],
898
                 self.__oh.at[WeekDaysShort.sa, OpenClose.summer_open],
899
                 self.__oh.at[WeekDaysShort.su, OpenClose.summer_open],
900
                 self.__oh.at[WeekDaysShort.mo, OpenClose.summer_close],
901
                 self.__oh.at[WeekDaysShort.tu, OpenClose.summer_close],
902
                 self.__oh.at[WeekDaysShort.we, OpenClose.summer_close],
903
                 self.__oh.at[WeekDaysShort.th, OpenClose.summer_close],
904
                 self.__oh.at[WeekDaysShort.fr, OpenClose.summer_close],
905
                 self.__oh.at[WeekDaysShort.sa, OpenClose.summer_close],
906
                 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...
907
                 self.__lunch_break['stop'],
908
                 self.__public_holiday_open, self.__opening_hours, self.__good, self.__bad])
909
            self.clear_all()
910
        except Exception as err:
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...
911
            logging.error(err)
912
            logging.error(traceback.print_exc())
913
914
    def process(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
915
        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...
916
        df.columns = POI_COLS
917
        return df.where((pd.notnull(df)), None)
918
919
    def lenght(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
920
        return len(self.insert_data)
921