File size: 1,297 Bytes
4019e87 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
class BaseService:
def __init__(self, name, parameters):
self.name = name
self.parameters = parameters
def execute(self, input_data):
raise NotImplementedError("Subclasses must implement the execute method.")
# Service One implementation with parameters
class ServiceOne(BaseService):
def __init__(self):
parameters = {
"Parameter 1": None,
"Parameter 2": None
# Add more parameters as needed
}
super().__init__("Service One", parameters)
def execute(self, input_data):
# Implement the logic for Service One using self.parameters
output_data = f"Service One executed with input: {input_data}, Parameters: {self.parameters}"
return output_data
# Service Two implementation with parameters
class ServiceTwo(BaseService):
def __init__(self):
parameters = {
"Parameter A": None,
"Parameter B": None
# Add more parameters as needed
}
super().__init__("Service Two", parameters)
def execute(self, input_data):
# Implement the logic for Service Two using self.parameters
output_data = f"Service Two executed with input: {input_data}, Parameters: {self.parameters}"
return output_data |