MCPcopy Create free account
hub / github.com/bterwijn/memory_graph / make_sliceable

Function make_sliceable

memory_graph/utils.py:150–158  ·  view source on GitHub ↗

Returns a sliceble version of data, convert to list if not yet sliceble.

(data)

Source from the content-addressed store, hash-verified

148 ]
149
150def make_sliceable(data):
151 """ Returns a sliceble version of data, convert to list if not yet sliceble. """
152 try:
153 data[0:0]
154 return data
155 except TypeError:
156 return list(data)
157 except Exception:
158 return []
159
160def is_finite_iterable(data):
161 """ Returns 'True' if 'data' is finite iterable. """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected