MCPcopy
hub / github.com/apple/ml-4m / try_cast

Function try_cast

run_generation.py:328–332  ·  view source on GitHub ↗
(item, dtype)

Source from the content-addressed store, hash-verified

326 return [input_string]
327
328 def try_cast(item, dtype):
329 try:
330 return dtype(item)
331 except ValueError:
332 return None
333
334 return [try_cast(item, dtype) for item in input_string.split(delim)]
335

Callers 1

string_to_listFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected