Rosetta
Static Public Member Functions | Static Private Attributes | List of all members
pyrosetta.bindings.scores.serialization.PoseScoreSerializer Class Reference
Inheritance diagram for pyrosetta.bindings.scores.serialization.PoseScoreSerializer:
Inheritance graph
[legend]

Static Public Member Functions

def maybe_encode (value)
 
def maybe_decode (value)
 
- Static Public Member Functions inherited from pyrosetta.bindings.scores.serialization.PoseScoreSerializerBase
def to_pickle (value)
 
def from_pickle (value)
 
def to_base64 (value)
 
def from_base64 (value)
 
def to_base64_pickle (value)
 
def from_base64_pickle (value)
 
def bool_from_str (value)
 

Static Private Attributes

tuple _reserved_types = (str, float)
 
 _CustomTypeMetric
 
dictionary _custom_type_metrics
 

Detailed Description

Serialize and deserialize score values for CustomStringValueMetric SimpleMetric.

Examples:
    Automatically serialize an arbitrary score value:
        `pose.cache["foo"] = value`
    Automatically deserialize an arbitrary score value:
        `value = pose.cache["foo"]`
    Manually serialize an arbitrary score value:
        `value = PoseScoreSerializer.maybe_encode(value)`
    Manually deserialize an arbitrary score value:
        `value = PoseScoreSerializer.maybe_decode(value)`

Member Function Documentation

◆ maybe_decode()

def pyrosetta.bindings.scores.serialization.PoseScoreSerializer.maybe_decode (   value)
static

◆ maybe_encode()

def pyrosetta.bindings.scores.serialization.PoseScoreSerializer.maybe_encode (   value)
static
Serialize the input value into a `str` object if it's not a `str` or `float` object.

References pyrosetta.tests.distributed.test_dask.format.

Referenced by pyrosetta.bindings.scores.extra_scores.ExtraScoresAccessorBase.__setitem__(), and pyrosetta.bindings.scores.base.PoseCacheAccessorBase.apply().

Member Data Documentation

◆ _custom_type_metrics

dictionary pyrosetta.bindings.scores.serialization.PoseScoreSerializer._custom_type_metrics
staticprivate
Initial value:
= {
"bool": _CustomTypeMetric(
type=bool,
prefix="[CustomBooleanValueMetric]",
encode_func=str,
decode_func=PoseScoreSerializerBase.bool_from_str,
),
"int": _CustomTypeMetric(
type=int,
prefix="[CustomDiscreteValueMetric]",
encode_func=str,
decode_func=int,
),
"bytes": _CustomTypeMetric(
type=bytes,
prefix="[CustomBinaryValueMetric]",
encode_func=PoseScoreSerializerBase.to_base64,
decode_func=PoseScoreSerializerBase.from_base64,
),
"object": _CustomTypeMetric(
type=object,
prefix="[CustomArbitraryValueMetric]",
encode_func=PoseScoreSerializerBase.to_base64_pickle,
decode_func=PoseScoreSerializerBase.from_base64_pickle,
),
}

◆ _CustomTypeMetric

pyrosetta.bindings.scores.serialization.PoseScoreSerializer._CustomTypeMetric
staticprivate
Initial value:
= collections.namedtuple(
"CustomTypeMetric", ["type", "prefix", "encode_func", "decode_func"],
)

◆ _reserved_types

tuple pyrosetta.bindings.scores.serialization.PoseScoreSerializer._reserved_types = (str, float)
staticprivate

The documentation for this class was generated from the following file: