Conditions | 1 |
Total Lines | 164 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
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 | from __future__ import absolute_import |
||
182 | def _create_index(self): |
||
183 | mapping = { |
||
184 | "mappings": { |
||
185 | "benchmark": { |
||
186 | "properties": { |
||
187 | "commit_info": { |
||
188 | "properties": { |
||
189 | "dirty": { |
||
190 | "type": "boolean" |
||
191 | }, |
||
192 | "id": { |
||
193 | "type": "string", |
||
194 | "index": "not_analyzed" |
||
195 | |||
196 | }, |
||
197 | "project": { |
||
198 | "type": "string", |
||
199 | "index": "not_analyzed" |
||
200 | } |
||
201 | } |
||
202 | }, |
||
203 | "datetime": { |
||
204 | "type": "date", |
||
205 | "format": "strict_date_optional_time||epoch_millis" |
||
206 | }, |
||
207 | "name": { |
||
208 | "type": "string", |
||
209 | "index": "not_analyzed" |
||
210 | }, |
||
211 | "fullname": { |
||
212 | "type": "string", |
||
213 | "index": "not_analyzed" |
||
214 | }, |
||
215 | "version": { |
||
216 | "type": "string", |
||
217 | "index": "not_analyzed" |
||
218 | }, |
||
219 | "benchmark_id": { |
||
220 | "type": "string", |
||
221 | "index": "not_analyzed", |
||
222 | }, |
||
223 | "machine_info": { |
||
224 | "properties": { |
||
225 | "machine": { |
||
226 | "type": "string", |
||
227 | "index": "not_analyzed" |
||
228 | }, |
||
229 | "node": { |
||
230 | "type": "string", |
||
231 | "index": "not_analyzed" |
||
232 | }, |
||
233 | "processor": { |
||
234 | "type": "string", |
||
235 | "index": "not_analyzed" |
||
236 | }, |
||
237 | "python_build": { |
||
238 | "type": "string", |
||
239 | "index": "not_analyzed" |
||
240 | }, |
||
241 | "python_compiler": { |
||
242 | "type": "string", |
||
243 | "index": "not_analyzed" |
||
244 | }, |
||
245 | "python_implementation": { |
||
246 | "type": "string", |
||
247 | "index": "not_analyzed" |
||
248 | }, |
||
249 | "python_implementation_version": { |
||
250 | "type": "string", |
||
251 | "index": "not_analyzed" |
||
252 | }, |
||
253 | "python_version": { |
||
254 | "type": "string", |
||
255 | "index": "not_analyzed" |
||
256 | }, |
||
257 | "release": { |
||
258 | "type": "string", |
||
259 | "index": "not_analyzed" |
||
260 | }, |
||
261 | "system": { |
||
262 | "type": "string", |
||
263 | "index": "not_analyzed" |
||
264 | } |
||
265 | } |
||
266 | }, |
||
267 | "options": { |
||
268 | "properties": { |
||
269 | "disable_gc": { |
||
270 | "type": "boolean" |
||
271 | }, |
||
272 | "max_time": { |
||
273 | "type": "double" |
||
274 | }, |
||
275 | "min_rounds": { |
||
276 | "type": "long" |
||
277 | }, |
||
278 | "min_time": { |
||
279 | "type": "double" |
||
280 | }, |
||
281 | "timer": { |
||
282 | "type": "string" |
||
283 | }, |
||
284 | "warmup": { |
||
285 | "type": "boolean" |
||
286 | } |
||
287 | } |
||
288 | }, |
||
289 | "stats": { |
||
290 | "properties": { |
||
291 | "hd15iqr": { |
||
292 | "type": "double" |
||
293 | }, |
||
294 | "iqr": { |
||
295 | "type": "double" |
||
296 | }, |
||
297 | "iqr_outliers": { |
||
298 | "type": "long" |
||
299 | }, |
||
300 | "iterations": { |
||
301 | "type": "long" |
||
302 | }, |
||
303 | "ld15iqr": { |
||
304 | "type": "double" |
||
305 | }, |
||
306 | "max": { |
||
307 | "type": "double" |
||
308 | }, |
||
309 | "mean": { |
||
310 | "type": "double" |
||
311 | }, |
||
312 | "median": { |
||
313 | "type": "double" |
||
314 | }, |
||
315 | "min": { |
||
316 | "type": "double" |
||
317 | }, |
||
318 | "outliers": { |
||
319 | "type": "string" |
||
320 | }, |
||
321 | "q1": { |
||
322 | "type": "double" |
||
323 | }, |
||
324 | "q3": { |
||
325 | "type": "double" |
||
326 | }, |
||
327 | "rounds": { |
||
328 | "type": "long" |
||
329 | }, |
||
330 | "stddev": { |
||
331 | "type": "double" |
||
332 | }, |
||
333 | "stddev_outliers": { |
||
334 | "type": "long" |
||
335 | }, |
||
336 | "ops": { |
||
337 | "type": "double" |
||
338 | }, |
||
339 | } |
||
340 | }, |
||
341 | } |
||
342 | } |
||
343 | } |
||
344 | } |
||
345 | self._es.indices.create(index=self._es_index, ignore=400, body=mapping) |
||
346 |