Coverage for src/probable_fiesta/app/builder/app.py: 74%
38 statements
« prev ^ index » next coverage.py v7.1.0, created at 2023-01-30 18:57 -0500
« prev ^ index » next coverage.py v7.1.0, created at 2023-01-30 18:57 -0500
1class App:
2 def __init__(self):
3 self.name = None
4 self.args = None
5 self.argument_parser = None
6 self.validated_args = None
7 self.config = None
8 self.variables = None
9 self.error = None
10 self.command = None
11 self.command_list = None
12 self.command_list_builder = None
13 self.command_queue = None
15 def __str__(self):
16 return f"App: {self.__dict__}"
18 def run(self, function):
19 """Run command."""
20 return function
22 def invoke(self):
23 if self.command is not None:
24 return self.command.invoke()
25 else:
26 return None
28 def run_command_list(self):
29 for command in self.command_list:
30 command.invoke()
31 return self
34class MyApp:
35 def __init__(self, context=None):
36 self.context = context
38 def __str__(self):
39 return f"MyApp: {self.__dict__}"
41 @staticmethod
42 def new_my_app(context=None):
43 return MyApp(context)
45 class Factory():
46 @staticmethod
47 def new_my_app(context=None):
48 return MyApp(context)
50 factory = Factory()