pygsti.baseobjs._compatibility

Tools for general compatibility.

Module Contents

Functions

isint(x)

Return whether x has an integer type.

_numpy14einsumfix()

str(.) on first arg of einsum skirts a bug in Numpy 14.0

patched_uuid()

Monkeypatch the uuid module with a fake SafeUUID

pygsti.baseobjs._compatibility.isint(x)

Return whether x has an integer type.

numbers.Integral is the ABC to which most integral types are registered, including int and all numpy.int variants. This function should be used in place of isinstance(x, int) or similar.

Parameters

x (object) – Object to check.

Returns

bool

pygsti.baseobjs._compatibility._numpy14einsumfix()

str(.) on first arg of einsum skirts a bug in Numpy 14.0

pygsti.baseobjs._compatibility.patched_uuid()

Monkeypatch the uuid module with a fake SafeUUID

uuid.SafeUUID is new in Python 3.7. This is a workaround to allow unpickling objects from >= 3.7 in < 3.7.

TODO: objects should be serialized correctly and this should be deprecated.