MCPcopy Create free account
hub / github.com/explorerhq/sql-explorer / safe_cast

Function safe_cast

explorer/utils.py:105–109  ·  view source on GitHub ↗
(val, to_type, default=None)

Source from the content-addressed store, hash-verified

103
104
105def safe_cast(val, to_type, default=None):
106 try:
107 return to_type(val)
108 except ValueError:
109 return default
110
111
112def get_int_from_request(request, name, default):

Callers 1

get_int_from_requestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected