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