MCPcopy
hub / github.com/pyodide/pyodide / get

Function get

src/js/api.ts:762–776  ·  view source on GitHub ↗
(target, symbol)

Source from the content-addressed store, hash-verified

760function wrapPythonGlobals(globals_dict: PyDict, builtins_dict: PyDict) {
761 return new Proxy(globals_dict, {
762 get(target, symbol) {
763 if (symbol === "get") {
764 return (key: any) => {
765 let result = target.get(key);
766 if (result === undefined) {
767 result = builtins_dict.get(key);
768 }
769 return result;
770 };
771 }
772 if (symbol === "has") {
773 return (key: any) => target.has(key) || builtins_dict.has(key);
774 }
775 return Reflect.get(target, symbol);
776 },
777 });
778}
779

Callers 1

test_pyproxy_dictFunction · 0.50

Calls 2

hasMethod · 0.80
getMethod · 0.45

Tested by 1

test_pyproxy_dictFunction · 0.40