Module tiresias.core

Expand source code
import pickle, codecs

def b64_encode(obj):
    """
    Take an arbitrary pickle-able object and encode it as a base64 string which
    can be transmitted as part of a JSON object.
    """
    return codecs.encode(pickle.dumps(obj), "base64").decode()

def b64_decode(obj):
    """
    Decode the given base64 string and attempt to unpickle it to recover the 
    original Python object.
    """
    return pickle.loads(codecs.decode(obj.encode(), "base64"))

Sub-modules

tiresias.core.classification
tiresias.core.gradients
tiresias.core.mechanisms
tiresias.core.regression

Functions

def b64_decode(obj)

Decode the given base64 string and attempt to unpickle it to recover the original Python object.

Expand source code
def b64_decode(obj):
    """
    Decode the given base64 string and attempt to unpickle it to recover the 
    original Python object.
    """
    return pickle.loads(codecs.decode(obj.encode(), "base64"))
def b64_encode(obj)

Take an arbitrary pickle-able object and encode it as a base64 string which can be transmitted as part of a JSON object.

Expand source code
def b64_encode(obj):
    """
    Take an arbitrary pickle-able object and encode it as a base64 string which
    can be transmitted as part of a JSON object.
    """
    return codecs.encode(pickle.dumps(obj), "base64").decode()