dql.output module

Formatting and displaying output

class dql.output.BaseFormat(results, ostream, width=u'auto', pagesize=u'auto')[source]

Bases: object

Base class for formatters

display(self)[source]

Write results to an output stream

format_field(self, field)[source]

Format a single Dynamo value

pagesize[source]

The number of results to display at a time

post_write(self)[source]

Called once after writing all records

pre_write(self)[source]

Called once before writing the very first record

wait(self)[source]

Block for user input

width[source]

The display width

write(self, result)[source]

Write a single result and stick it in an output stream

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

Bases: dql.output.BaseFormat

A layout that puts item attributes in columns

post_write(self)[source]
pre_write(self)[source]
wait(self)[source]

Block for user input

write(self, result)[source]
class dql.output.ExpandedFormat(results, ostream, width=u'auto', pagesize=u'auto')[source]

Bases: dql.output.BaseFormat

A layout that puts item attributes on separate lines

pagesize[source]
write(self, result)[source]
class dql.output.SmartBuffer(buf)[source]

Bases: object

A buffer that wraps another buffer and encodes unicode strings.

flush(self)[source]

flush the buffer

write(self, arg)[source]

Write a string or bytes object to the buffer

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

Bases: object

A layout that chooses column/expanded format intelligently

display(self)[source]

Write results to an output stream

dql.output.delta_to_str(rd)[source]

Convert a relativedelta to a human-readable string

dql.output.format_json(json_object, indent)[source]

Pretty-format json data

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

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

dql.output.make_list(obj)[source]

Turn an object into a list if it isn’t already

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