picop.cymapping#

Mapping protocol helpers.

picop.cymapping.map_check(o)#

Return True if o provides the mapping protocol. :type o: object :param o:

Return type:

bool

picop.cymapping.map_del(o, key)#

Delete o[key] via PyMapping_DelItem.

Notes

Returns 0 on success; errors raise — do not use the status as a bool.

Parameters:
Return type:

int

picop.cymapping.map_del_cstr(o, key)#

Delete o[key] via PyMapping_DelItemString.

Notes

key must be bytes, not str. Returns 0 on success; errors raise — do not use the status as a bool. Alias of map_del_string.

Parameters:
Return type:

int

picop.cymapping.map_eq(a, b)#

Return True if mappings are equal via identity/size short-circuit + richcompare.

Notes

Prefer dict_eq when both operands are known dict instances.

Parameters:
Return type:

bool

picop.cymapping.map_getitem_cstr(o, key)#

Return o[key] via PyMapping_GetItemString.

Notes

key must be bytes (ASCII/UTF-8), not str. See Safety. Alias of map_getitem_string (prefer *_cstr).

Parameters:
Return type:

object

picop.cymapping.map_has_key(o, key)#

Return True if mapping o has key. :type o: object :param o: :type key: object :param key:

Return type:

bool

picop.cymapping.map_has_key_cstr(o, key)#

Return True if mapping o has C-string key.

Notes

key must be bytes (ASCII/UTF-8), not str. See Safety. Alias of map_has_key_string (prefer *_cstr).

Parameters:
Return type:

bool

picop.cymapping.map_items(o)#

Return o.items() via PyMapping_Items. :type o: object :param o:

Return type:

object

picop.cymapping.map_keys(o)#

Return o.keys() via PyMapping_Keys. :type o: object :param o:

Return type:

object

picop.cymapping.map_len(o)#
picop.cymapping.map_setitem_cstr(o, key, v)#

Set o[key] = v via PyMapping_SetItemString.

Notes

key must be bytes, not str. Returns 0 on success; errors raise — do not use the status as a bool. Alias of map_setitem_string.

Parameters:
Return type:

int

picop.cymapping.map_values(o)#

Return o.values() via PyMapping_Values. :type o: object :param o:

Return type:

object