MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / _extract_to_closing_brace

Function _extract_to_closing_brace

Scripts/parse_headers.py:416–430  ·  view source on GitHub ↗

Starting at open_pos (which must be the '{'), find the matching '}'. Returns the content between them (exclusive).

(source: str, open_pos: int)

Source from the content-addressed store, hash-verified

414
415
416def _extract_to_closing_brace(source: str, open_pos: int) -> str:
417 """
418 Starting at open_pos (which must be the '{'), find the matching '}'.
419 Returns the content between them (exclusive).
420 """
421 assert source[open_pos] == '{'
422 depth = 0
423 for i in range(open_pos, len(source)):
424 if source[i] == '{':
425 depth += 1
426 elif source[i] == '}':
427 depth -= 1
428 if depth == 0:
429 return source[open_pos+1:i]
430 return source[open_pos+1:]
431
432
433def _strip_inline_bodies(text: str) -> str:

Callers 1

_parse_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected