MCPcopy Create free account
hub / github.com/Fadi002/de4py / replace_match

Method replace_match

de4py/engines/onyx/string_decoder.py:158–166  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

156 re.VERBOSE,
157 )
158 def replace_match(m):
159 raw = next(g for g in m.groups() if g is not None)
160 try:
161 val = ast.literal_eval(raw)
162 if isinstance(val, (str, bytes)):
163 return val if isinstance(val, str) else val.decode('utf-8', errors='replace')
164 except Exception:
165 pass
166 return m.group(0)
167 source = pattern.sub(replace_match, source)
168
169 # Pattern 2: eval(compile("literal", ...)) or exec(compile("literal", ...))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected