picop.cybytes#
Fast bytes accessors.
- picop.cybytes.bytes_bytearray_eq(a, b)#
Return True if
bytes/bytearraycontents match.Notes
Either argument order is accepted; compares with
memcmpafter a length gate.
- picop.cybytes.bytes_check(p)#
Return True if
pisbytesor a subtype (PyBytes_Check). :type p:object:param p:
- picop.cybytes.bytes_check_exact(p)#
Return True if
type(p) is bytes(PyBytes_CheckExact). :type p:object:param p:
- picop.cybytes.bytes_contains(haystack, needle)#
Return True if
needleis inhaystack.Notes
Uses
memchr/memmemunder 256B, else the builtininpath.
- picop.cybytes.bytes_endswith(s, suffix)#
Return True if typed
sends withsuffix.Notes
Length gate plus tail
memcmpon the typed suffix region.
- picop.cybytes.bytes_eq(a, b)#
Return True if
a == b.Notes
Identity/len short-circuit plus
memcmpon typedbytes.
- picop.cybytes.bytes_from_object(o)#
Return
bytesfrom a buffer-protocol object (PyBytes_FromObject). :type o:object:param o:- Return type:
- picop.cybytes.bytes_ne(a, b)#
Return True if
a != b(inverse ofbytes_eq). :type a:bytes:param a: :type b:bytes:param b:
- picop.cybytes.bytes_size(b)#
Return
len(b)via checkedPyBytes_Size.Notes
Prefer
bytes_lenon a typedbyteshot path.