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:135
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:345
static PyObject * JSObjectProxy_items_method(JSObjectProxy *self)
items method
Definition JSObjectProxy.cc:793
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:156
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:167
static PyObject * JSObjectProxy_update_method(JSObjectProxy *self, PyObject *args, PyObject *kwds)
update method update the dict with another dict or iterable
Definition JSObjectProxy.cc:758
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:72
static PyObject * JSObjectProxy_iter(JSObjectProxy *self)
Return an iterator object to make JSObjectProxy iterable, emitting (key, value) tuples.
Definition JSObjectProxy.cc:288
static PyObject * JSObjectProxy_iter_next(JSObjectProxy *self)
Implements next operator function.
Definition JSObjectProxy.cc:308
static PyObject * JSObjectProxy_clear_method(JSObjectProxy *self)
clear method
Definition JSObjectProxy.cc:718
static void JSObjectProxy_dealloc(JSObjectProxy *self)
Deallocation method (.tp_dealloc), removes the reference to the underlying JSObject before freeing th...
Definition JSObjectProxy.cc:52
static PyObject * JSObjectProxy_ior(JSObjectProxy *self, PyObject *other)
Set union operation, in place.
Definition JSObjectProxy.cc:590
static int JSObjectProxy_clear(JSObjectProxy *self)
tp_clear
Definition JSObjectProxy.cc:66
static PyObject * JSObjectProxy_or(JSObjectProxy *self, PyObject *other)
Set union operation.
Definition JSObjectProxy.cc:548
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:202
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:145
static PyObject * JSObjectProxy_get_method(JSObjectProxy *self, PyObject *const *args, Py_ssize_t nargs)
get method
Definition JSObjectProxy.cc:623
static int JSObjectProxy_traverse(JSObjectProxy *self, visitproc visit, void *arg)
tp_traverse
Definition JSObjectProxy.cc:60
static PyObject * JSObjectProxy_pop_method(JSObjectProxy *self, PyObject *const *args, Py_ssize_t nargs)
pop method
Definition JSObjectProxy.cc:680
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:189
static PyObject * JSObjectProxy_values_method(JSObjectProxy *self)
values method
Definition JSObjectProxy.cc:789
static bool JSObjectProxy_richcompare_helper(JSObjectProxy *self, PyObject *other, std::unordered_map< PyObject *, PyObject * > &visited)
Helper function for JSObjectProxy_richcompare.
Definition JSObjectProxy.cc:222
static PyObject * JSObjectProxy_keys_method(JSObjectProxy *self)
keys method
Definition JSObjectProxy.cc:785
static PyObject * JSObjectProxy_setdefault_method(JSObjectProxy *self, PyObject *const *args, Py_ssize_t nargs)
setdefault method
Definition JSObjectProxy.cc:648
static PyObject * JSObjectProxy_copy_method(JSObjectProxy *self)
copy method
Definition JSObjectProxy.cc:735
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