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