dql.output module

Formatting and displaying output

class dql.output.BaseFormat(width=100, pagesize=1000)[source]

Bases: object

Base class for formatters

format(result, ostream)[source]

Format a single result and stick it in an output stream

format_field(field)[source]

Format a single Dynamo value

write(results, ostream)[source]

Write results to an output stream

class dql.output.ColumnFormat(width=100, pagesize=1000)[source]

Bases: dql.output.BaseFormat

A layout that puts item attributes in columns

format(results, columns, ostream)[source]
write(results, ostream)[source]
class dql.output.ExpandedFormat(width=100, pagesize=1000)[source]

Bases: dql.output.BaseFormat

A layout that puts item attributes on separate lines

format(result, ostream)[source]
class dql.output.SmartBuffer(buf)[source]

Bases: object

A buffer that wraps another buffer and encodes unicode strings.

flush()[source]

flush the buffer

write(arg)[source]

Write a string or bytes object to the buffer

class dql.output.SmartFormat(*args, **kwargs)[source]

Bases: dql.output.ColumnFormat

A layout that chooses column/expanded format intelligently

format(results, columns, ostream)[source]
dql.output.format_json(json_object, indent)[source]

Pretty-format json data

dql.output.get_default_display()[source]

Get the default display function for this system

dql.output.less_display(*args, **kwds)[source]

Use smoke and mirrors to acquire ‘less’ for pretty paging

dql.output.serialize_json_var(obj)[source]

Serialize custom types to JSON

dql.output.stdout_display(*args, **kwds)[source]

Print results straight to stdout

dql.output.truncate(string, length, ellipsis=u'\u2026')[source]

Truncate a string to a length, ending with ‘...’ if it overflows

dql.output.wrap(string, length, indent)[source]

Wrap a string at a line length