benchmarkstt.diff.formatter module

%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#e7f2fa', 'lineColor': '#2980B9' }}}%% classDiagram JSONDiffDialect Dialect DiffFormatter UTF8Dialect RestructuredTextDialect ANSIDiffDialect HTMLDiffDialect ListDialect Dialect <|-- ANSIDiffDialect Dialect <|-- UTF8Dialect Dialect <|-- HTMLDiffDialect ANSIDiffDialect <|-- RestructuredTextDialect Dialect <|-- ListDialect ListDialect <|-- JSONDiffDialect class Dialect { <<context>> +output() } class ANSIDiffDialect { <<context>> +output() preprocessor(txt)$ show_color_key=None } class UTF8Dialect { <<context>> +delete_format(txt) +insert_format(txt) +output() preprocessor(txt)$ } class HTMLDiffDialect { <<context>> +output() preprocessor(txt)$ } class RestructuredTextDialect { <<context>> +output() preprocessor(txt)$ show_color_key=None } class ListDialect { <<context>> +delete_format(txt) +equal_format(txt) +insert_format(txt) +output() +replace_format(a, b) preprocessor(txt)$ } class JSONDiffDialect { <<context>> +delete_format(txt) +equal_format(txt) +insert_format(txt) +output() +replace_format(a, b) preprocessor(txt)$ } class DiffFormatter { +diff(a, b, opcodes=None, preprocessor=None) dialect=None *args **kwargs has_dialect(dialect)$ }
class benchmarkstt.diff.formatter.ANSIDiffDialect(show_color_key=None)[source]

Bases: benchmarkstt.diff.formatter.Dialect

delete_format = '\x1b[31m%s\x1b[0m'
insert_format = '\x1b[32m%s\x1b[0m'
static preprocessor(txt)[source]
class benchmarkstt.diff.formatter.Dialect[source]

Bases: object

delete_format = '%s'
equal_format = '%s'
insert_format = '%s'
output()[source]
preprocessor = None
replace_format = None
property stream
class benchmarkstt.diff.formatter.DiffFormatter(dialect=None, *args, **kwargs)[source]

Bases: object

diff(a, b, opcodes=None, preprocessor=None)[source]
diff_dialects = {'ansi': <class 'benchmarkstt.diff.formatter.ANSIDiffDialect'>, 'html': <class 'benchmarkstt.diff.formatter.HTMLDiffDialect'>, 'json': <class 'benchmarkstt.diff.formatter.JSONDiffDialect'>, 'list': <class 'benchmarkstt.diff.formatter.ListDialect'>, 'rst': <class 'benchmarkstt.diff.formatter.RestructuredTextDialect'>, 'text': <class 'benchmarkstt.diff.formatter.UTF8Dialect'>}
classmethod has_dialect(dialect)[source]
class benchmarkstt.diff.formatter.HTMLDiffDialect[source]

Bases: benchmarkstt.diff.formatter.Dialect

delete_format = '<span class="delete">%s</span>'
insert_format = '<span class="insert">%s</span>'
static preprocessor(txt)[source]
class benchmarkstt.diff.formatter.JSONDiffDialect[source]

Bases: benchmarkstt.diff.formatter.ListDialect

output()[source]
class benchmarkstt.diff.formatter.ListDialect[source]

Bases: benchmarkstt.diff.formatter.Dialect

delete_format(txt)[source]

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

equal_format(txt)[source]

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

insert_format(txt)[source]

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

output()[source]
static preprocessor(txt)[source]
replace_format(a, b)[source]
class benchmarkstt.diff.formatter.RestructuredTextDialect(show_color_key=None)[source]

Bases: benchmarkstt.diff.formatter.ANSIDiffDialect

delete_format = '\\ :diffdelete:`%s`\\ '
insert_format = '\\ :diffinsert:`%s`\\ '
static preprocessor(txt)[source]
class benchmarkstt.diff.formatter.UTF8Dialect[source]

Bases: benchmarkstt.diff.formatter.Dialect

delete_format(txt)[source]

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

insert_format(txt)[source]

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

static preprocessor(txt)[source]
benchmarkstt.diff.formatter.format_diff(a, b, opcodes=None, dialect=None, preprocessor=None)[source]