@@ -36,7 +36,9 @@ class ProjectBuilder:
36
36
def __init__ (self , configuration : ProjectConfiguration ) -> None :
37
37
self .configuration = configuration
38
38
39
- def gather_plugins (self , plugin_type : Type [Plugin ]) -> list [Type [Plugin ]]:
39
+ DerivedPlugin = TypeVar ("DerivedPlugin" , bound = Plugin )
40
+
41
+ def gather_plugins (self , plugin_type : Type [DerivedPlugin ]) -> list [Type [DerivedPlugin ]]:
40
42
"""
41
43
TODO
42
44
"""
@@ -50,29 +52,29 @@ def gather_plugins(self, plugin_type: Type[Plugin]) -> list[Type[Plugin]]:
50
52
51
53
return plugins
52
54
53
- def generate_model (self , plugins : list [Type [Plugin ]]) -> Type [PyProject ]:
55
+ def generate_model (self , plugins : list [Type [Generator ]]) -> Type [PyProject ]:
54
56
"""
55
57
TODO
56
58
"""
57
59
plugin_fields = {}
58
60
for plugin_type in plugins :
59
61
plugin_fields [plugin_type .name ()] = plugin_type .data_type ()
60
62
61
- ExtendedCPPythonData = create_model (
63
+ extended_cppython_type = create_model (
62
64
"ExtendedCPPythonData" ,
63
65
** plugin_fields ,
64
66
__base__ = CPPythonData ,
65
67
)
66
68
67
- ExtendedToolData = create_model (
69
+ extended_tool_type = create_model (
68
70
"ToolData" ,
69
- cppython = ExtendedCPPythonData ,
71
+ cppython = extended_cppython_type ,
70
72
__base__ = ToolData ,
71
73
)
72
74
73
75
return create_model (
74
76
"PyProject" ,
75
- tool = ExtendedToolData ,
77
+ tool = extended_tool_type ,
76
78
__base__ = PyProject ,
77
79
)
78
80
@@ -110,8 +112,8 @@ def __init__(
110
112
interface .print ("No generator plugin was found." )
111
113
return
112
114
113
- ExtendedPyProject = builder .generate_model (plugins )
114
- pyproject = ExtendedPyProject (** pyproject_data )
115
+ extended_pyproject_type = builder .generate_model (plugins )
116
+ pyproject = extended_pyproject_type (** pyproject_data )
115
117
116
118
if pyproject .tool is None :
117
119
if self .configuration .verbose :
0 commit comments