Sets proper option types
(inputOptions)
| 2339 | logger.setLevel(CUSTOM_LOGGING.TRAFFIC_IN) |
| 2340 | |
| 2341 | def _normalizeOptions(inputOptions): |
| 2342 | """ |
| 2343 | Sets proper option types |
| 2344 | """ |
| 2345 | |
| 2346 | types_ = {} |
| 2347 | for group in optDict.keys(): |
| 2348 | types_.update(optDict[group]) |
| 2349 | |
| 2350 | for key in inputOptions: |
| 2351 | if key in types_: |
| 2352 | value = inputOptions[key] |
| 2353 | if value is None: |
| 2354 | continue |
| 2355 | |
| 2356 | type_ = types_[key] |
| 2357 | if type_ and isinstance(type_, tuple): |
| 2358 | type_ = type_[0] |
| 2359 | |
| 2360 | if type_ == OPTION_TYPE.BOOLEAN: |
| 2361 | try: |
| 2362 | value = bool(value) |
| 2363 | except (TypeError, ValueError): |
| 2364 | value = False |
| 2365 | elif type_ == OPTION_TYPE.INTEGER: |
| 2366 | try: |
| 2367 | value = int(value) |
| 2368 | except (TypeError, ValueError): |
| 2369 | value = 0 |
| 2370 | elif type_ == OPTION_TYPE.FLOAT: |
| 2371 | try: |
| 2372 | value = float(value) |
| 2373 | except (TypeError, ValueError): |
| 2374 | value = 0.0 |
| 2375 | |
| 2376 | inputOptions[key] = value |
| 2377 | |
| 2378 | def _mergeOptions(inputOptions, overrideOptions): |
| 2379 | """ |
no test coverage detected
searching dependent graphs…