Conditions | 1 |
Total Lines | 157 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
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:
If many parameters/temporary variables are present:
1 | import datetime |
||
141 | def _create_index(self): |
||
142 | mapping = { |
||
143 | "mappings": { |
||
144 | "benchmark": { |
||
145 | "properties": { |
||
146 | "commit_info": { |
||
147 | "properties": { |
||
148 | "dirty": { |
||
149 | "type": "boolean" |
||
150 | }, |
||
151 | "id": { |
||
152 | "type": "string", |
||
153 | "index": "not_analyzed" |
||
154 | |||
155 | }, |
||
156 | "project": { |
||
157 | "type": "string", |
||
158 | "index": "not_analyzed" |
||
159 | } |
||
160 | } |
||
161 | }, |
||
162 | "datetime": { |
||
163 | "type": "date", |
||
164 | "format": "strict_date_optional_time||epoch_millis" |
||
165 | }, |
||
166 | "name": { |
||
167 | "type": "string", |
||
168 | "index": "not_analyzed" |
||
169 | }, |
||
170 | "fullname": { |
||
171 | "type": "string", |
||
172 | "index": "not_analyzed" |
||
173 | }, |
||
174 | "version": { |
||
175 | "type": "string", |
||
176 | "index": "not_analyzed" |
||
177 | }, |
||
178 | "machine_info": { |
||
179 | "properties": { |
||
180 | "machine": { |
||
181 | "type": "string", |
||
182 | "index": "not_analyzed" |
||
183 | }, |
||
184 | "node": { |
||
185 | "type": "string", |
||
186 | "index": "not_analyzed" |
||
187 | }, |
||
188 | "processor": { |
||
189 | "type": "string", |
||
190 | "index": "not_analyzed" |
||
191 | }, |
||
192 | "python_build": { |
||
193 | "type": "string", |
||
194 | "index": "not_analyzed" |
||
195 | }, |
||
196 | "python_compiler": { |
||
197 | "type": "string", |
||
198 | "index": "not_analyzed" |
||
199 | }, |
||
200 | "python_implementation": { |
||
201 | "type": "string", |
||
202 | "index": "not_analyzed" |
||
203 | }, |
||
204 | "python_implementation_version": { |
||
205 | "type": "string", |
||
206 | "index": "not_analyzed" |
||
207 | }, |
||
208 | "python_version": { |
||
209 | "type": "string", |
||
210 | "index": "not_analyzed" |
||
211 | }, |
||
212 | "release": { |
||
213 | "type": "string", |
||
214 | "index": "not_analyzed" |
||
215 | }, |
||
216 | "system": { |
||
217 | "type": "string", |
||
218 | "index": "not_analyzed" |
||
219 | } |
||
220 | } |
||
221 | }, |
||
222 | "options": { |
||
223 | "properties": { |
||
224 | "disable_gc": { |
||
225 | "type": "boolean" |
||
226 | }, |
||
227 | "max_time": { |
||
228 | "type": "double" |
||
229 | }, |
||
230 | "min_rounds": { |
||
231 | "type": "long" |
||
232 | }, |
||
233 | "min_time": { |
||
234 | "type": "double" |
||
235 | }, |
||
236 | "timer": { |
||
237 | "type": "string" |
||
238 | }, |
||
239 | "warmup": { |
||
240 | "type": "boolean" |
||
241 | } |
||
242 | } |
||
243 | }, |
||
244 | "stats": { |
||
245 | "properties": { |
||
246 | "hd15iqr": { |
||
247 | "type": "double" |
||
248 | }, |
||
249 | "iqr": { |
||
250 | "type": "double" |
||
251 | }, |
||
252 | "iqr_outliers": { |
||
253 | "type": "long" |
||
254 | }, |
||
255 | "iterations": { |
||
256 | "type": "long" |
||
257 | }, |
||
258 | "ld15iqr": { |
||
259 | "type": "double" |
||
260 | }, |
||
261 | "max": { |
||
262 | "type": "double" |
||
263 | }, |
||
264 | "mean": { |
||
265 | "type": "double" |
||
266 | }, |
||
267 | "median": { |
||
268 | "type": "double" |
||
269 | }, |
||
270 | "min": { |
||
271 | "type": "double" |
||
272 | }, |
||
273 | "outliers": { |
||
274 | "type": "string" |
||
275 | }, |
||
276 | "q1": { |
||
277 | "type": "double" |
||
278 | }, |
||
279 | "q3": { |
||
280 | "type": "double" |
||
281 | }, |
||
282 | "rounds": { |
||
283 | "type": "long" |
||
284 | }, |
||
285 | "stddev": { |
||
286 | "type": "double" |
||
287 | }, |
||
288 | "stddev_outliers": { |
||
289 | "type": "long" |
||
290 | } |
||
291 | } |
||
292 | }, |
||
293 | } |
||
294 | } |
||
295 | } |
||
296 | } |
||
297 | self._elasticsearch.indices.create(index=self._elasticsearch_index, ignore=400, body=mapping) |
||
298 | |||
299 |