msml.sorts

Sorts logic.

Factory and Cache for Sorts in MSML.

Currently there are two disjoint sorts hierarchies.

  1. format
  2. type

format describes the kind of storage (e.g. file format) type is the definition of the ground data type (e.g. vector of ints) sortdef ## example

vector.int + file.vtk

result in: file_vtk__vector_int as subtype of file and vector

sortsdef => name of a sort, characterize by multiple path, seperated with »+« path => name/path in the class hierarchy, each class is seperated with ».«

Functions

default_conversion_network()
default_sorts_definition() return default sorts definition
get_sort(t[, f]) returns the type object for the given sort definition
is_sort(x)

Classes

ConversionNetwork([data])
SortsDefinition([default_sorts])

Exceptions

MSMLMissingConversionException
class msml.sorts.ConversionNetwork(data=None, **attr)[source]

Bases: networkx.classes.digraph.DiGraph

converter(a, b)[source]

returns a function that converts elements of type a to element with type b.

register_conversion(a, b, fn, precedence)[source]
exception msml.sorts.MSMLMissingConversionException[source]

Bases: msml.exceptions.MSMLException

class msml.sorts.SortsDefinition(default_sorts=True)[source]

Bases: object

get_sort(physical, logical=None)[source]
register_logical(clazz, name=None)[source]
register_physical(clazz, name=None)[source]
register_type_with_name(name)[source]
msml.sorts.default_conversion_network()[source]
msml.sorts.default_sorts_definition()[source]

return default sorts definition

msml.sorts.get_sort(t, f=None)[source]

returns the type object for the given sort definition

msml.sorts.is_sort(x)[source]