@@ -329,8 +329,9 @@ def limited_weight_t(self, limited_weight_t):
329
329
:param limited_weight_t:
330
330
:return:
331
331
"""
332
- if isinstance (limited_weight_t , types .LongType ) or isinstance (limited_weight_t ,
333
- types .IntType ):
332
+ if isinstance (limited_weight_t , types .LongType ) or \
333
+ isinstance (limited_weight_t , float ) or \
334
+ isinstance (limited_weight_t , types .IntType ):
334
335
self ._copy_data ({'limited_weight_t' : limited_weight_t })
335
336
else :
336
337
raise ParamValueException ('limited_weight_t' , 'Must be integer or long' )
@@ -341,47 +342,51 @@ def weight_per_axle_t(self, weight_per_axle_t):
341
342
:param weight_per_axle_t:
342
343
:return:
343
344
"""
344
- if isinstance (weight_per_axle_t , types .LongType ) or isinstance (weight_per_axle_t ,
345
- types .IntType ):
345
+ if isinstance (weight_per_axle_t , types .LongType ) or \
346
+ isinstance (weight_per_axle_t , float ) or \
347
+ isinstance (weight_per_axle_t , types .IntType ):
346
348
self ._copy_data ({'weight_per_axle_t' : weight_per_axle_t })
347
349
else :
348
350
raise ParamValueException ('weight_per_axle_t' , 'Must be integer or long' )
349
351
350
- def truck_height_meters (self , truck_height_meters ):
352
+ def truck_height (self , truck_height ):
351
353
"""
352
- Set truck_height_meters param
353
- :param truck_height_meters :
354
+ Set truck_height param
355
+ :param truck_height :
354
356
:return:
355
357
"""
356
- if isinstance (truck_height_meters , types .LongType ) or isinstance (truck_height_meters ,
357
- types .IntType ):
358
- self ._copy_data ({'truck_height_meters' : truck_height_meters })
358
+ if isinstance (truck_height , types .LongType ) or \
359
+ isinstance (truck_height , float ) or \
360
+ isinstance (truck_height , types .IntType ):
361
+ self ._copy_data ({'truck_height' : truck_height })
359
362
else :
360
- raise ParamValueException ('truck_height_meters ' , 'Must be integer or long' )
363
+ raise ParamValueException ('truck_height ' , 'Must be integer or long' )
361
364
362
- def truck_width_meters (self , truck_width_meters ):
365
+ def truck_width (self , truck_width ):
363
366
"""
364
- Set truck_width_meters param
365
- :param truck_width_meters :
367
+ Set truck_width param
368
+ :param truck_width :
366
369
:return:
367
370
"""
368
- if isinstance (truck_width_meters , types .LongType ) or isinstance (truck_width_meters ,
369
- types .IntType ):
370
- self ._copy_data ({'truck_width_meters' : truck_width_meters })
371
+ if isinstance (truck_width , types .LongType ) or \
372
+ isinstance (truck_width , float ) or \
373
+ isinstance (truck_width , types .IntType ):
374
+ self ._copy_data ({'truck_width' : truck_width })
371
375
else :
372
- raise ParamValueException ('truck_width_meters ' , 'Must be integer or long' )
376
+ raise ParamValueException ('truck_width ' , 'Must be integer or long' )
373
377
374
- def truck_length_meters (self , truck_length_meters ):
378
+ def truck_length (self , truck_length ):
375
379
"""
376
- Set truck_length_meters param
377
- :param truck_length_meters :
380
+ Set truck_length param
381
+ :param truck_length :
378
382
:return:
379
383
"""
380
- if isinstance (truck_length_meters , types .LongType ) or isinstance (truck_length_meters ,
381
- types .IntType ):
382
- self ._copy_data ({'truck_length_meters' : truck_length_meters })
384
+ if isinstance (truck_length , types .LongType ) or \
385
+ isinstance (truck_length , float ) or \
386
+ isinstance (truck_length , types .IntType ):
387
+ self ._copy_data ({'truck_length' : truck_length })
383
388
else :
384
- raise ParamValueException ('truck_length_meters ' , 'Must be integer or long' )
389
+ raise ParamValueException ('truck_length ' , 'Must be integer or long' )
385
390
386
391
def min_tour_size (self , min_tour_size ):
387
392
"""
@@ -789,3 +794,13 @@ def add(self, params={}, data={}):
789
794
self .data .update (data )
790
795
self .params .update (params )
791
796
797
+ def truck_hazardous_goods (self , truck_hazardous_goods ):
798
+ """
799
+ Set truck_hazardous_goods param
800
+ :param truck_hazardous_goods:
801
+ :return:
802
+ """
803
+ if truck_hazardous_goods in TRUCK_HAZARDOUS_GOODS .reverse_mapping .keys ():
804
+ self ._copy_data ({'truck_hazardous_goods' : truck_hazardous_goods })
805
+ else :
806
+ raise ParamValueException ('truck_hazardous_goods' , 'Must be MI or KM' )
0 commit comments