MCPcopy Create free account
hub / github.com/CScorza/IntelOSINT / _safe

Function _safe

IntelOSINT.py:19959–19981  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

19957 }
19958
19959 def _safe(v):
19960 if v is None:
19961 return None
19962 if isinstance(v, bytes):
19963 try:
19964 return v.decode("utf-8", errors="replace")
19965 except Exception:
19966 return repr(v)
19967 if isinstance(v, (str, int, float, bool)):
19968 return v
19969 if isinstance(v, dict):
19970 out = {}
19971 for kk, vv in v.items():
19972 k2 = _safe(kk)
19973 v2 = _safe(vv)
19974 if k2 is not None:
19975 out[str(k2)] = v2
19976 return out
19977 if isinstance(v, (list, tuple)):
19978 return [_safe(x) for x in v]
19979 if hasattr(v, "printable"):
19980 return str(v.printable)
19981 return str(v)
19982
19983 def _parse_video_coord(raw):
19984 if raw is None:

Callers 2

_collect_tagsFunction · 0.85
probe_image_metadataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected