11#ifndef PythonMonkey_JSObjectProxy_
12#define PythonMonkey_JSObjectProxy_
18#include <unordered_map>
253 "__getitem__($self, key, /)\n--\n\nReturn self[key].");
256 "get($self, key, default=None, /)\n"
259 "Return the value for key if key is in the dictionary, else default.");
262 "setdefault($self, key, default=None, /)\n"
265 "Insert key with a value of default if key is not in the dictionary.\n"
267 "Return the value for key if key is in the dictionary, else default.");
270 "pop($self, key, default=<unrepresentable>, /)\n"
273 "D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n"
275 "If the key is not found, return the default if given; otherwise,\n"
276 "raise a KeyError.");
279 "D.clear() -> None. Remove all items from D.");
282 "D.copy() -> a shallow copy of D");
285 "D.keys() -> a set-like object providing a view on D's keys");
287 "D.items() -> a set-like object providing a view on D's items");
289 "D.values() -> an object providing a view on D's values");
292 "D.update([E, ]**F) -> None. Update D from dict/iterable E and F.\n\
293If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]\n\
294If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v\n\
295In either case, this is followed by: for k in F: D[k] = F[k]");
298 "D.keys() -> a set-like object providing a view on D's keys");
300 "D.items() -> a set-like object providing a view on D's items");
302 "D.values() -> an object providing a view on D's values");
308static PyMappingMethods JSObjectProxy_mapping_methods = {
318static PySequenceMethods JSObjectProxy_sequence_methods = {
322static PyNumberMethods JSObjectProxy_number_methods = {
331static PyMethodDef JSObjectProxy_methods[] = {
PyDoc_STRVAR(getitem__doc__, "__getitem__($self, key, /)\n--\n\nReturn self[key].")
PyTypeObject JSObjectProxyType
Struct for the JSObjectProxyType, used by all JSObjectProxy objects.
Definition pythonmonkey.cc:134
This struct is a bundle of methods used by the JSObjectProxy type.
Definition JSObjectProxy.hh:34
static PyObject * JSObjectProxy_repr(JSObjectProxy *self)
Compute a string representation of the JSObjectProxy.
Definition JSObjectProxy.cc:343
static PyObject * JSObjectProxy_items_method(JSObjectProxy *self)
items method
Definition JSObjectProxy.cc:790
static PyObject * JSObjectProxy_get_subscript(JSObjectProxy *self, PyObject *key)
Getter method (.mp_subscript), returns a value from the JSObjectProxy given a key,...
Definition JSObjectProxy.cc:154
static int JSObjectProxy_contains(JSObjectProxy *self, PyObject *key)
Test method (.sq_contains), returns whether a key exists, used by the in operator.
Definition JSObjectProxy.cc:165
static PyObject * JSObjectProxy_update_method(JSObjectProxy *self, PyObject *args, PyObject *kwds)
update method update the dict with another dict or iterable
Definition JSObjectProxy.cc:755
static Py_ssize_t JSObjectProxy_length(JSObjectProxy *self)
Length method (.mp_length), returns the number of key-value pairs in the JSObject,...
Definition JSObjectProxy.cc:70
static PyObject * JSObjectProxy_iter(JSObjectProxy *self)
Return an iterator object to make JSObjectProxy iterable, emitting (key, value) tuples.
Definition JSObjectProxy.cc:286
static PyObject * JSObjectProxy_iter_next(JSObjectProxy *self)
Implements next operator function.
Definition JSObjectProxy.cc:306
static PyObject * JSObjectProxy_clear_method(JSObjectProxy *self)
clear method
Definition JSObjectProxy.cc:715
static void JSObjectProxy_dealloc(JSObjectProxy *self)
Deallocation method (.tp_dealloc), removes the reference to the underlying JSObject before freeing th...
Definition JSObjectProxy.cc:50
static PyObject * JSObjectProxy_ior(JSObjectProxy *self, PyObject *other)
Set union operation, in place.
Definition JSObjectProxy.cc:588
static int JSObjectProxy_clear(JSObjectProxy *self)
tp_clear
Definition JSObjectProxy.cc:64
static PyObject * JSObjectProxy_or(JSObjectProxy *self, PyObject *other)
Set union operation.
Definition JSObjectProxy.cc:546
static PyObject * JSObjectProxy_richcompare(JSObjectProxy *self, PyObject *other, int op)
Comparison method (.tp_richcompare), returns appropriate boolean given a comparison operator and othe...
Definition JSObjectProxy.cc:200
static PyObject * JSObjectProxy_get(JSObjectProxy *self, PyObject *key)
Getter method, returns a value from the JSObjectProxy given a key, used by several built-in python me...
Definition JSObjectProxy.cc:143
static PyObject * JSObjectProxy_get_method(JSObjectProxy *self, PyObject *const *args, Py_ssize_t nargs)
get method
Definition JSObjectProxy.cc:621
static int JSObjectProxy_traverse(JSObjectProxy *self, visitproc visit, void *arg)
tp_traverse
Definition JSObjectProxy.cc:58
static PyObject * JSObjectProxy_pop_method(JSObjectProxy *self, PyObject *const *args, Py_ssize_t nargs)
pop method
Definition JSObjectProxy.cc:677
static int JSObjectProxy_assign(JSObjectProxy *self, PyObject *key, PyObject *value)
Assign method (.mp_ass_subscript), assigns a key-value pair if value is non-NULL, or deletes a key-va...
Definition JSObjectProxy.cc:187
static PyObject * JSObjectProxy_values_method(JSObjectProxy *self)
values method
Definition JSObjectProxy.cc:786
static bool JSObjectProxy_richcompare_helper(JSObjectProxy *self, PyObject *other, std::unordered_map< PyObject *, PyObject * > &visited)
Helper function for JSObjectProxy_richcompare.
Definition JSObjectProxy.cc:220
static PyObject * JSObjectProxy_keys_method(JSObjectProxy *self)
keys method
Definition JSObjectProxy.cc:782
static PyObject * JSObjectProxy_setdefault_method(JSObjectProxy *self, PyObject *const *args, Py_ssize_t nargs)
setdefault method
Definition JSObjectProxy.cc:645
static PyObject * JSObjectProxy_copy_method(JSObjectProxy *self)
copy method
Definition JSObjectProxy.cc:732
The typedef for the backing store that will be used by JSObjectProxy objects. All it contains is a po...
Definition JSObjectProxy.hh:25
JS::PersistentRootedObject * jsObject
Definition JSObjectProxy.hh:27
PyDictObject dict
Definition JSObjectProxy.hh:26