MCPcopy Create free account
hub / github.com/Link-AGI/AutoAgents / parse_code

Method parse_code

autoagents/system/utils/common.py:163–174  ·  view source on GitHub ↗
(cls, block: str, text: str, lang: str = "")

Source from the content-addressed store, hash-verified

161
162 @classmethod
163 def parse_code(cls, block: str, text: str, lang: str = "") -> str:
164 if block:
165 text = cls.parse_block(block, text)
166 pattern = rf'```{lang}.*?\s+(.*?)```'
167 match = re.search(pattern, text, re.DOTALL)
168 if match:
169 code = match.group(1)
170 else:
171 logger.error(f"{pattern} not match following text:")
172 logger.error(text)
173 raise Exception
174 return code
175
176 @classmethod
177 def parse_str(cls, block: str, text: str, lang: str = ""):

Callers 8

write_codeMethod · 0.45
write_codeMethod · 0.45
_save_prdMethod · 0.45
_save_system_designMethod · 0.45
parse_dataMethod · 0.45
parse_strMethod · 0.45
parse_file_listMethod · 0.45

Calls 2

parse_blockMethod · 0.80
searchMethod · 0.45

Tested by

no test coverage detected