MCPcopy Create free account
hub / github.com/SolaWing/xcode-build-server / json_loads

Function json_loads

config/cmd.py:141–159  ·  view source on GitHub ↗
(s: str)

Source from the content-addressed store, hash-verified

139 return update(None if lastest_scheme else scheme)
140
141def json_loads(s: str):
142 # https://github.com/swiftlang/swift-package-manager/blob/f19d08cf79250514851490599319d22771074b01/Sources/PackageLoading/TargetSourcesBuilder.swift#L194
143 # SPM print error message to stdout, skip it
144 brace = s.find("{")
145 bracket = s.find("[")
146 if brace < 0: start = bracket
147 elif bracket < 0: start = brace
148 else: start = min(brace, bracket)
149 if start < 0: start = 0
150
151 brace = s.rfind("}")
152 bracket = s.rfind("]")
153 if brace < 0: end = bracket
154 elif bracket < 0: end = brace
155 else: end = max(brace, bracket)
156 if end < 0: end = len(s)
157 else: end = end + 1
158
159 return json.loads(s[start:end])

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected