MCPcopy
hub / github.com/pyodide/pyodide / set

Function set

src/core/pyproxy.ts:2263–2277  ·  view source on GitHub ↗
(jsobj: PyProxy, jskey: string | symbol, jsval: any)

Source from the content-addressed store, hash-verified

2261 return python_getattr(jsobj, jskey);
2262 },
2263 set(jsobj: PyProxy, jskey: string | symbol, jsval: any): boolean {
2264 let descr = Object.getOwnPropertyDescriptor(jsobj, jskey);
2265 if (descr && !descr.writable && !descr.set) {
2266 return false;
2267 }
2268 // python_setattr will crash if given a Symbol.
2269 if (typeof jskey === "symbol" || filteredHasKey(jsobj, jskey, true)) {
2270 return Reflect.set(jsobj, jskey, jsval);
2271 }
2272 if (jskey.startsWith("$")) {
2273 jskey = jskey.slice(1);
2274 }
2275 python_setattr(jsobj, jskey, jsval);
2276 return true;
2277 },
2278 deleteProperty(jsobj: PyProxy, jskey: string | symbol): boolean {
2279 let descr = Object.getOwnPropertyDescriptor(jsobj, jskey);
2280 if (descr && !descr.configurable) {

Callers 15

collect_testsFunction · 0.85
show_not_backportedFunction · 0.85
calculate_diffFunction · 0.85
mainFunction · 0.85
filterfuncFunction · 0.85
test_defaultfilterfuncFunction · 0.85
test_pyproxy_classFunction · 0.85
test_pyproxy_iterFunction · 0.85
test_pyproxy_dictFunction · 0.85

Calls 7

filteredHasKeyFunction · 0.85
python_setattrFunction · 0.85
isPythonErrorFunction · 0.85
setMethod · 0.80
sliceMethod · 0.80
callMethod · 0.80
hasMethod · 0.80

Tested by 15

collect_testsFunction · 0.68
test_defaultfilterfuncFunction · 0.68
test_pyproxy_classFunction · 0.68
test_pyproxy_iterFunction · 0.68
test_pyproxy_dictFunction · 0.68
test_find_importsFunction · 0.68
test_tojs9Function · 0.68
test_jsproxy_dirFunction · 0.68