benchmarkstt.schema module

%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#e7f2fa', 'lineColor': '#2980B9' }}}%% classDiagram SchemaJSONError SchemaError Meta Item Schema JSONEncoder SchemaInvalidItemError JSONDecoder ValueError <|-- SchemaError SchemaError <|-- SchemaJSONError SchemaError <|-- SchemaInvalidItemError Mapping <|-- Item defaultdict <|-- Meta Item <.. Schema class SchemaError { } class SchemaJSONError { } class SchemaInvalidItemError { } class Item { <<len>> <<mapping>> <<contains>> <<iterable>> <<comparable>> *args **kwargs +get(key, default=None) +items() +json(**kwargs) +keys() +values() } class Meta { } class Schema { <<len>> <<mapping>> <<iterable>> <<comparable>> +append(obj: Item) +extend(iterable) +json(**kwargs) data=None dump(*args, **kwargs)$ dumps(*args, **kwargs)$ load(*args, **kwargs)$ loads(*args, **kwargs)$ } class JSONEncoder { +default(o) +encode(obj) +iterencode(o, _one_shot=False) skipkeys=False ensure_ascii=True check_circular=True allow_nan=True sort_keys=False indent=None separators=None default=None } class JSONDecoder { *args **kwargs +decode(*args, **kwargs) +raw_decode(s, idx=0) object_hook(obj)$ }

Defines the main schema for comparison and implements json serialization

class benchmarkstt.schema.Item(*args, **kwargs)[source]

Bases: collections.abc.Mapping

Basic structure of each field to compare

Raises

ValueError, SchemaInvalidItemError

json(**kwargs)[source]
class benchmarkstt.schema.JSONDecoder(*args, **kwargs)[source]

Bases: json.decoder.JSONDecoder

Custom JSON decoding for schema

decode(*args, **kwargs)[source]

Return the Python representation of s (a str instance containing a JSON document).

static object_hook(obj)[source]
class benchmarkstt.schema.JSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: json.encoder.JSONEncoder

Custom JSON encoding for schema

default(o)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
encode(obj)[source]

Return a JSON string representation of a Python data structure.

>>> from json.encoder import JSONEncoder
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo": ["bar", "baz"]}'
class benchmarkstt.schema.Meta[source]

Bases: collections.defaultdict

Containing metadata for an item, such as skipped

class benchmarkstt.schema.Schema(data=None)[source]

Bases: object

Basically a list of Item

append(obj: benchmarkstt.schema.Item)[source]
static dump(cls, *args, **kwargs)[source]
static dumps(cls, *args, **kwargs)[source]
extend(iterable)[source]
json(**kwargs)[source]
static load(*args, **kwargs)[source]
static loads(*args, **kwargs)[source]
exception benchmarkstt.schema.SchemaError[source]

Bases: ValueError

Top Error class for all schema related exceptions

exception benchmarkstt.schema.SchemaInvalidItemError[source]

Bases: benchmarkstt.schema.SchemaError

Attempting to add an invalid item

exception benchmarkstt.schema.SchemaJSONError[source]

Bases: benchmarkstt.schema.SchemaError

When loading incompatible JSON