MCPcopy Create free account
hub / github.com/WeaveMindAI/weft / extract_bracket_content

Function extract_bracket_content

scripts/audit_nodes.py:38–54  ·  view source on GitHub ↗

Extract content of [...] after keyword, handling nested brackets.

(text, keyword)

Source from the content-addressed store, hash-verified

36 issues.append(f"TYPE_MISMATCH: {node} -> FE:{fe_type} BE:{be_type}")
37
38 def extract_bracket_content(text, keyword):
39 """Extract content of [...] after keyword, handling nested brackets."""
40 idx = text.find(keyword)
41 if idx == -1:
42 return None
43 start = text.find('[', idx)
44 if start == -1:
45 return None
46 depth = 0
47 for i in range(start, len(text)):
48 if text[i] == '[':
49 depth += 1
50 elif text[i] == ']':
51 depth -= 1
52 if depth == 0:
53 return text[start+1:i]
54 return None
55
56 # --- Extract FE inputs ---
57 inputs_content = extract_bracket_content(fe, 'defaultInputs')

Callers 1

audit_nodes.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected