MCPcopy Index your code
hub / github.com/data-apis/python-record-api / create

Method create

record_api/core.py:248–268  ·  view source on GitHub ↗
(cls, fn, args, kwargs)

Source from the content-addressed store, hash-verified

246
247 @classmethod
248 def create(cls, fn, args, kwargs) -> Optional[Bound]:
249 try:
250 sig = safe_signature(fn)
251 except ValueError:
252 return None
253 try:
254 bound = sig.bind(*args, **kwargs)
255 except TypeError:
256 return None
257 b = cls()
258 for k, v in bound.arguments.items():
259 kind = sig.parameters[k].kind
260 if kind == inspect.Parameter.POSITIONAL_ONLY:
261 b.pos_only.append((k, preprocess(v)))
262 elif kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
263 b.pos_or_kw.append((k, preprocess(v)))
264 elif kind == inspect.Parameter.VAR_POSITIONAL:
265 b.var_pos = k, preprocess(v)
266 elif kind == inspect.Parameter.KEYWORD_ONLY:
267 b.kw_only[k] = preprocess(v)
268 return b
269
270
271def log_call(

Callers 1

log_callFunction · 0.80

Calls 4

safe_signatureFunction · 0.85
preprocessFunction · 0.85
itemsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected