def _get_override_object_for_key(self, dict_name, key): override_value = self._get_override_value_for_key(dict_name, key) if override_value is missing_data: override_value = 1.0 override = Override.from_float(override_value) return override
def _get_dict_of_items_with_overrides(self, dict_name): find_object_dict = dict(dict_name=dict_name) cursor = self._mongo.collection.find(find_object_dict) key_values = [(db_entry['key'], Override.from_float(db_entry['value'])) for db_entry in cursor] result_dict = dict(key_values) return result_dict
def get_overide_object_from_user(): invalid_input = True while invalid_input: print("Overide options are: A number between 0.0 and 1.0 that we multiply the natural position by,") print(" or one of the following special values %s" % override_dict) value = input("Your value?") value = float(value) try: override_object = Override.from_float(value) return override_object except Exception as e: print(e)