Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"data": {
jsii_name: _make_reference_for_native(kernel, getattr(d, python_name)) for python_name, jsii_name in mapping.items()
}
}
}
return d
elif isinstance(d, (int, type(None), str, float, bool, datetime.datetime)):
return d
elif isinstance(d, (FunctionType, MethodType, BuiltinFunctionType, LambdaType)):
# Whether a given object is a function-like object.
# We won't use iscallable() since objects may implement __call__()
# but we still want to serialize them as normal.
raise JSIIError("Cannot pass function as argument here (did you mean to call this function?): %r" % d)
else:
kernel.create(d.__class__, d)
_reference_map.register_reference(d)
return d
def __call__(cls, *args, **kwargs):
inst = super().__call__(*args, **kwargs)
# Register this instance with our reference map.
_reference_map.register_reference(inst)
return inst