Source code for dronebuddylib.models.engine_configurations
from dronebuddylib.models.enums import Configurations
[docs]
class EngineConfigurations:
def __init__(self, configurations: dict):
self.configurations = configurations
[docs]
def add_configuration(self, key: Configurations, value: str):
self.configurations[key] = value
[docs]
def remove_configurations(self, key: Configurations) -> str:
return self.configurations.pop(key)
[docs]
def get_configuration(self, key: Configurations) -> str:
return self.configurations.get(key)
[docs]
def get_configurations(self) -> dict:
return self.configurations
[docs]
def get_configurations_for_engine(self, class_name: str) -> dict:
# return all the key pairs which contains a given string as a part of the key
filtered_items = {}
for key, value in self.configurations.items():
if class_name in key.name:
filtered_items[key] = value
return filtered_items