BlobSet¶
-
class
lsst.verify.BlobSet(blobs=None)[source]¶ Bases:
lsst.verify.jsonmixin.JsonSerializationMixinA collection of
Blobs.Parameters: blobs :
listoflsst.verify.BlobsBlobs to include in the set.
Attributes Summary
jsonA dictthat can be serialized as JSON.Methods Summary
deserialize([blobs])Create a BlobSet from a parsed JSON dataset. insert(blob)Insert a blob into the set. items()Iterate over (identifier, Blob) pairs in the set.jsonify_dict(d)Recursively build JSON-renderable objects on all values in a dict. keys()Get a sequence of blob identifiers, which are keys to the BlobSet. write_json(filepath)Write JSON to a file. Attributes Documentation
Methods Documentation
-
classmethod
deserialize(blobs=None)[source]¶ Create a BlobSet from a parsed JSON dataset.
Parameters: blobs :
list, optionalA list of blob JSON serializations.
Returns: instance :
BlobSetA
BlobSetinstance.
-
insert(blob)[source]¶ Insert a blob into the set.
Parameters: blob :
BlobBlobto insert into the set. It can be accessed by key from the BlobSet through itsBlob.identifierstring.
-
items()[source]¶ Iterate over (identifier,
Blob) pairs in the set.Yields: item :
tupleTuple containing:
Blob.identifierof theBlob(str)Blobinstance
-
jsonify_dict(d)¶ Recursively build JSON-renderable objects on all values in a dict.
Parameters: d :
dictDictionary to convert into a JSON-serializable object. Values are recursively JSON-ified.
Returns: json_dict :
dictDictionary that can be serialized to JSON.
Examples
Subclasses can use this method to prepare output in their
json-method implementation. For example:def json(self): return JsonSerializationMixin.jsonify_dict({ 'value': self.value, })
-
keys()[source]¶ Get a sequence of blob identifiers, which are keys to the BlobSet.
Returns: keys : sequence of
strSequence of
Blob.identifier.
-
classmethod