Ejemplo n.º 1
0
def int_marshal(byte_size, sign, endian="native"):
    return (keep_kwargs_partial(pack_int,
                                byte_size=byte_size,
                                sign=sign,
                                endian=endian),
            keep_kwargs_partial(unpack_int,
                                byte_size=byte_size,
                                sign=sign,
                                endian=endian))
Ejemplo n.º 2
0
def str_type_factory(encoding='ascii',
                     padding=' ',
                     strip='\x00',
                     justify='left',
                     byte_size=None):
    kwargs = dict(encoding=encoding,
                  padding=padding,
                  strip=strip,
                  justify=justify)
    if byte_size:
        kwargs['byte_size'] = byte_size
    return (keep_kwargs_partial(pack_str, **kwargs),
            keep_kwargs_partial(unpack_str, **kwargs))
Ejemplo n.º 3
0
def str_type_factory(encoding='ascii', padding=' ', strip='\x00', justify='left', byte_size=None):
    kwargs = dict(encoding=encoding, padding=padding, strip=strip, justify=justify)
    if byte_size:
        kwargs['byte_size'] = byte_size
    return (keep_kwargs_partial(pack_str, **kwargs), keep_kwargs_partial(unpack_str, **kwargs))
Ejemplo n.º 4
0
def int_marshal(byte_size, sign, endian="native"):
    return (keep_kwargs_partial(pack_int, byte_size=byte_size, sign=sign, endian=endian),
            keep_kwargs_partial(unpack_int, byte_size=byte_size, sign=sign, endian=endian))
Ejemplo n.º 5
0
def str_type_factory(encoding="ascii", padding=" ", strip="\x00", justify="left", byte_size=None):
    kwargs = dict(encoding=encoding, padding=padding, strip=strip, justify=justify)
    if byte_size:
        kwargs["byte_size"] = byte_size
    return (keep_kwargs_partial(pack_str, **kwargs), keep_kwargs_partial(unpack_str, **kwargs))