GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — v1 ( b4dcfa...110339 )
by Maksim
01:36
created

Optimization.name()   A

Complexity

Conditions 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.125

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
ccs 1
cts 2
cp 0.5
crap 1.125
1
# -*- coding: utf-8 -*-
2
3
# reimport enums for convenience:
4 1
from ..enums import AlgorithmTypeEnum
5 1
from ..enums import OptimizationStateEnum
6 1
from ..enums import OptimizationQualityEnum
7 1
from ..enums import OptimizationFactorEnum
8 1
from ..enums import RouteMetricEnum
9 1
from ..enums import TravelModeEnum
10 1
from ..enums import DeviceTypeEnum
11
12 1
from route4me.sdk._internals.utils import dict_property
13 1
from route4me.sdk._internals.utils import dict_enum_property
14
15
16 1
class BaseModel(dict):
17 1
	def __init__(self, raw=None):
18 1
		super(BaseModel, self).__init__(raw)
19
20 1
	@property
21
	def raw(self):
22
		"""
23
		Provides access to raw model data, as it would be sent to Route4Me API
24
25
		:getter: Get, property is readonly
26
		:rtype: dict
27
		"""
28 1
		return self
29
30
31 1
class Optimization(BaseModel):
32
	"""
33
	Optimization problem (or simple *Optimization*)
34
	"""
35
36 1
	def __init__(self, raw=None):
37
		"""
38
		Create instance **LOCALLY**.
39
40
		Use :meth:`~route4me.sdk.resources.optimizations.Optimizations.create`
41
		to create new Optimization Problem in the Route4Me API
42
43
		:param raw: Raw values for new optimization, example: \
44
			`create optimization <https://route4me.io/docs/#create-an-optimization>`_, \
45
			defaults to None
46
		:type raw: dict, optional
47
		"""
48 1
		if raw is None:
49 1
			raw = {
50
				'parameters': {
51
					'store_route': True,
52
					'route_max_duration': 24 * 60 * 60,
53
				},
54
				'links': {},
55
				'addresses': []
56
			}
57 1
		super(Optimization, self).__init__(raw=raw)
58
59 1
	@property
60
	def ID(self):
61 1
		return self.raw.get('optimization_problem_id')
62
63 1
	@dict_enum_property('parameters.algorithm_type', AlgorithmTypeEnum)
64
	def algorithm_type(self, value):
65
		"""
66
		The algorithm type to be used
67
68
		<AUTO>
69
		"""
70 1
		return value
71
72 1
	@dict_enum_property('state', OptimizationStateEnum)
73
	def state(self, value):
74
		"""
75
		The current state of the optimization
76
77
		<AUTO>
78
		"""
79 1
		return value
80
81 1
	@dict_enum_property('parameters.optimization_quality', OptimizationQualityEnum)
82
	def quality(self, value):
83
		"""
84
		Optimization quality
85
86
		There are 3 types of optimization qualities that are optimizations
87
		goals, see :class:`~route4me.sdk.enums.OptimizationQualityEnum`
88
89
		<AUTO>
90
		"""
91
		return value
92
93 1
	@dict_enum_property('parameters.metric', RouteMetricEnum)
94
	def metric(self, value):
95
		"""
96
		Metric
97
98
		<AUTO>
99
		"""
100
		return value
101
102 1
	@dict_enum_property('parameters.travel_mode', TravelModeEnum)
103
	def travel_mode(self, value):
104
		"""
105
		Travel mode
106
107
		The mode of travel that the directions should be optimized for
108
109
		<AUTO>
110
		"""
111
		return value
112
113 1
	@dict_enum_property('parameters.device_type', DeviceTypeEnum)
114
	def device_type(self, value):
115
		"""
116
		Device type
117
118
		The type of the device that is creating this Optimization Problem
119
120
		<AUTO>
121
		"""
122
		return value
123
124 1
	@dict_enum_property('parameters.optimize', OptimizationFactorEnum)
125
	def optimization_factor(self, value):
126
		"""
127
		The driving directions can be generated biased for this selection. This
128
		has no impact on route sequencing.
129
130
		.. note::
131
132
			In Route4Me API this enum also known as ``optimize``
133
134
		<AUTO>
135
		"""
136 1
		return value
137
138
	# ==========================================================================
139
140
	# @dict_property('parameters.store_route', bool)
141
	# def store_route(self, value):
142
	# 	"""
143
	# 	Store Route
144
145
	# 	<AUTO>
146
	# 	"""
147
	# 	return value
148
149 1
	@dict_property('parameters.route_name', str)
150
	def name(self, value):
151
		"""
152
		The name of this optimization problem. This name will be accessible in
153
		the search API, and also will be displayed on the mobile device of
154
		a user
155
156
		<AUTO>
157
		"""
158
		return value
159
160 1
	@dict_property('parameters.parts', int)
161
	def parts(self, value):
162
		"""
163
		Legacy feature which permits a user to request an example number of
164
		optimized routes
165
166
		<AUTO>
167
		"""
168
		return value
169
170 1
	@dict_property('parameters.disable_optimization', bool)
171
	def disable_optimization(self, value):
172
		"""
173
		By disabling optimization, the route optimization engine will not
174
		resequence stops in your optimization problem
175
176
		<AUTO>
177
		"""
178
		return value
179
180 1
	@dict_property('parameters.route_max_duration', int)
181
	def route_max_duration_sec(self, value):
182
		"""
183
		Route Maximum Duration
184
185
		How many seconds a route can last at most.
186
		Default is 24 hours = 86400 seconds
187
188
		<AUTO>
189
		"""
190
		return value
191
192 1
	@dict_property('parameters.rt', bool)
193
	def round_trip(self, value):
194
		"""
195
		Round Trip
196
197
		The tour type of this route. The optimization engine changes its
198
		behavior for round trip routes
199
200
		.. note::
201
202
			In Route4Me API this parameter is also known as ``parameters.rt``
203
204
205
		<AUTO>
206
		"""
207
		return value
208
209 1
	@dict_property('parameters.member_id', str)
210
	def member_id(self, value):
211
		"""
212
		Member ID
213
214
		User ID who is assigned to this Optimization Problem
215
216
		<AUTO>
217
		"""
218
		return value
219
220 1
	@dict_property('parameters.device_id', str)
221
	def device_id(self, value):
222
		"""
223
		Device ID
224
225
		32 Character MD5 String ID of the device that was used to plan this
226
		route
227
228
		<AUTO>
229
		"""
230
		return value
231
232 1
	@dict_property('parameters.vehicle_id', str)
233
	def vehicle_id(self, value):
234
		"""
235
		Vehicle ID
236
237
		The unique internal id of a vehicle
238
239
		<AUTO>
240
		"""
241
		return value
242
243
	# 'route_time': route_timestamp,
244
245
	# addresses,
246