MCPcopy Index your code
hub / github.com/Codeplain-ai/codeplain / render_functional_requirement

Method render_functional_requirement

codeplain_REST_api.py:172–224  ·  view source on GitHub ↗

Renders the content of a functionality based on the provided ID, corresponding sections from a Plain document, and existing files' content. Args: frid (str): The unique identifier for the functionality to be rendered. plain_source_tree (dict): A dict

(
        self,
        frid: str,
        plain_source_tree: dict,
        linked_resources: dict,
        existing_files_content: dict,
        memory_files_content: dict,
        module_name: str,
        required_modules: dict,
        include_unittests: bool,
        run_state: RunState,
    )

Source from the content-addressed store, hash-verified

170 return self.post_request(endpoint_url, headers, payload, None, num_retries=0, silent=True)
171
172 def render_functional_requirement(
173 self,
174 frid: str,
175 plain_source_tree: dict,
176 linked_resources: dict,
177 existing_files_content: dict,
178 memory_files_content: dict,
179 module_name: str,
180 required_modules: dict,
181 include_unittests: bool,
182 run_state: RunState,
183 ) -> dict[str, str]:
184 """
185 Renders the content of a functionality based on the provided ID,
186 corresponding sections from a Plain document, and existing files' content.
187
188 Args:
189 frid (str): The unique identifier for the functionality to be rendered.
190 plain_source_tree (dict): A dictionary containing the plain source tree.
191 linked_resources (dict): A dictionary where the keys represent filenames of linked
192 resources and the values are dictionaries containing
193 the content of the linked resources and the sections
194 they are linked to.
195 existing_files_content (dict): A dictionary where the keys represent filenames
196 and the values are the content of those files.
197 memory_files_content (dict): A dictionary where the keys represent memory filenames
198 and the values are the content of those files.
199 module_name (str): The name of the module to render the functionality for.
200 required_modules (dict): A dictionary where the keys represent module names
201 and the values are lists of functionalities implemented in those modules.
202 run_state (RunState): The current state of the rendering process.
203 Returns:
204 dict[str, str]: A dictionary where the keys are filenames and the values
205 are the rendered code for those files.
206
207 Raises:
208 ValueError: If the frid is invalid or the necessary sections cannot be found.
209 """
210 endpoint_url = f"{self.api_url}/render_functional_requirement"
211 headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
212
213 payload = {
214 "frid": frid,
215 "plain_source_tree": plain_source_tree,
216 "linked_resources": linked_resources,
217 "existing_files_content": existing_files_content,
218 "memory_files_content": memory_files_content,
219 "module_name": module_name,
220 "required_modules": required_modules,
221 "include_unittests": include_unittests,
222 }
223
224 return self.post_request(endpoint_url, headers, payload, run_state)
225
226 def fix_unittests_issue(
227 self,

Callers 1

executeMethod · 0.80

Calls 1

post_requestMethod · 0.95

Tested by

no test coverage detected