accessories

Accessory functions.

encoding_from_lang(lang)[source]

Parse encoding from LANG environment value.

Example:

>>> encoding_from_lang('en_US.UTF-8@misc')
'UTF-8'
name_unicode(ucs)[source]

Return 7-bit ascii printable of any string.

eightbits(number)[source]

Binary representation of number padded to 8 bits.

Example:

>>> eightbits(ord('a'))
'0b01100001'
make_logger(name, loglevel='info', logfile=None, logfmt='%(asctime)s %(levelname)s %(filename)s:%(lineno)d %(message)s')[source]

Create and return simple logger for given arguments.

repr_mapping(mapping)[source]

Return printable string, ‘key=value [key=value …]’ for mapping.

function_lookup(pymod_path)[source]

Return callable function target from standard module.function path.

make_reader_task(reader, size=4096)[source]

Return asyncio task wrapping coroutine of reader.read(size).