| 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 |
||
| 120 | def _create_index(self): |
||
| 121 | mapping = { |
||
| 122 | "mappings": { |
||
| 123 | "benchmark": { |
||
| 124 | "properties": { |
||
| 125 | "commit_info": { |
||
| 126 | "properties": { |
||
| 127 | "dirty": { |
||
| 128 | "type": "boolean" |
||
| 129 | }, |
||
| 130 | "id": { |
||
| 131 | "type": "string", |
||
| 132 | "index": "not_analyzed" |
||
| 133 | |||
| 134 | }, |
||
| 135 | "project": { |
||
| 136 | "type": "string", |
||
| 137 | "index": "not_analyzed" |
||
| 138 | } |
||
| 139 | } |
||
| 140 | }, |
||
| 141 | "datetime": { |
||
| 142 | "type": "date", |
||
| 143 | "format": "strict_date_optional_time||epoch_millis" |
||
| 144 | }, |
||
| 145 | "name": { |
||
| 146 | "type": "string", |
||
| 147 | "index": "not_analyzed" |
||
| 148 | }, |
||
| 149 | "fullname": { |
||
| 150 | "type": "string", |
||
| 151 | "index": "not_analyzed" |
||
| 152 | }, |
||
| 153 | "version": { |
||
| 154 | "type": "string", |
||
| 155 | "index": "not_analyzed" |
||
| 156 | }, |
||
| 157 | "machine_info": { |
||
| 158 | "properties": { |
||
| 159 | "machine": { |
||
| 160 | "type": "string", |
||
| 161 | "index": "not_analyzed" |
||
| 162 | }, |
||
| 163 | "node": { |
||
| 164 | "type": "string", |
||
| 165 | "index": "not_analyzed" |
||
| 166 | }, |
||
| 167 | "processor": { |
||
| 168 | "type": "string", |
||
| 169 | "index": "not_analyzed" |
||
| 170 | }, |
||
| 171 | "python_build": { |
||
| 172 | "type": "string", |
||
| 173 | "index": "not_analyzed" |
||
| 174 | }, |
||
| 175 | "python_compiler": { |
||
| 176 | "type": "string", |
||
| 177 | "index": "not_analyzed" |
||
| 178 | }, |
||
| 179 | "python_implementation": { |
||
| 180 | "type": "string", |
||
| 181 | "index": "not_analyzed" |
||
| 182 | }, |
||
| 183 | "python_implementation_version": { |
||
| 184 | "type": "string", |
||
| 185 | "index": "not_analyzed" |
||
| 186 | }, |
||
| 187 | "python_version": { |
||
| 188 | "type": "string", |
||
| 189 | "index": "not_analyzed" |
||
| 190 | }, |
||
| 191 | "release": { |
||
| 192 | "type": "string", |
||
| 193 | "index": "not_analyzed" |
||
| 194 | }, |
||
| 195 | "system": { |
||
| 196 | "type": "string", |
||
| 197 | "index": "not_analyzed" |
||
| 198 | } |
||
| 199 | } |
||
| 200 | }, |
||
| 201 | "options": { |
||
| 202 | "properties": { |
||
| 203 | "disable_gc": { |
||
| 204 | "type": "boolean" |
||
| 205 | }, |
||
| 206 | "max_time": { |
||
| 207 | "type": "double" |
||
| 208 | }, |
||
| 209 | "min_rounds": { |
||
| 210 | "type": "long" |
||
| 211 | }, |
||
| 212 | "min_time": { |
||
| 213 | "type": "double" |
||
| 214 | }, |
||
| 215 | "timer": { |
||
| 216 | "type": "string" |
||
| 217 | }, |
||
| 218 | "warmup": { |
||
| 219 | "type": "boolean" |
||
| 220 | } |
||
| 221 | } |
||
| 222 | }, |
||
| 223 | "stats": { |
||
| 224 | "properties": { |
||
| 225 | "hd15iqr": { |
||
| 226 | "type": "double" |
||
| 227 | }, |
||
| 228 | "iqr": { |
||
| 229 | "type": "double" |
||
| 230 | }, |
||
| 231 | "iqr_outliers": { |
||
| 232 | "type": "long" |
||
| 233 | }, |
||
| 234 | "iterations": { |
||
| 235 | "type": "long" |
||
| 236 | }, |
||
| 237 | "ld15iqr": { |
||
| 238 | "type": "double" |
||
| 239 | }, |
||
| 240 | "max": { |
||
| 241 | "type": "double" |
||
| 242 | }, |
||
| 243 | "mean": { |
||
| 244 | "type": "double" |
||
| 245 | }, |
||
| 246 | "median": { |
||
| 247 | "type": "double" |
||
| 248 | }, |
||
| 249 | "min": { |
||
| 250 | "type": "double" |
||
| 251 | }, |
||
| 252 | "outliers": { |
||
| 253 | "type": "string" |
||
| 254 | }, |
||
| 255 | "q1": { |
||
| 256 | "type": "double" |
||
| 257 | }, |
||
| 258 | "q3": { |
||
| 259 | "type": "double" |
||
| 260 | }, |
||
| 261 | "rounds": { |
||
| 262 | "type": "long" |
||
| 263 | }, |
||
| 264 | "stddev": { |
||
| 265 | "type": "double" |
||
| 266 | }, |
||
| 267 | "stddev_outliers": { |
||
| 268 | "type": "long" |
||
| 269 | } |
||
| 270 | } |
||
| 271 | }, |
||
| 272 | } |
||
| 273 | } |
||
| 274 | } |
||
| 275 | } |
||
| 276 | self._elasticsearch.indices.create(index=self._elasticsearch_index, ignore=400, body=mapping) |
||
| 277 | |||
| 278 |