mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-05 22:02:38 +02:00
feat: + move remove_white_spaces
This commit is contained in:
parent
34225d08b5
commit
df8f929665
2 changed files with 16 additions and 16 deletions
|
|
@ -603,3 +603,16 @@ def list_files(root: str | Path) -> List[Path]:
|
|||
def parse_json_code_block(markdown_text: str) -> List[str]:
|
||||
json_blocks = re.findall(r"```json(.*?)```", markdown_text, re.DOTALL)
|
||||
return [v.strip() for v in json_blocks]
|
||||
|
||||
|
||||
def remove_white_spaces(v: str) -> str:
|
||||
"""
|
||||
Removes white spaces from the provided string, excluding spaces within quotes.
|
||||
|
||||
Args:
|
||||
v (str): The input string containing white spaces.
|
||||
|
||||
Returns:
|
||||
str: The input string with white spaces removed, excluding spaces within quotes.
|
||||
"""
|
||||
return re.sub(r"(?<!['\"])\s|(?<=['\"])\s", "", v)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue