pygsti.baseobjs.mongoserializable.RecursiveRemovalSpecification

pygsti.baseobjs.mongoserializable.RecursiveRemovalSpecification#

class RecursiveRemovalSpecification(edesigns=False, data=False, results=False, circuits=False, protocols=False, children=False)#

Bases: object

Specifies which types of objects to remove when performing a recursive removal of MongoDB documents.

Parameters:
  • edesigns (bool, optional) – Whether experiment designs are allowed to be removed.

  • data (bool, optional) – Whether protocol data objects are allowed to be removed.

  • results (bool, optional) – Whether result objects and directories are allowed to be removed.

  • circuits (bool, optional) – Whether circuit objects stored in common collections (e.g. “pygsti_circuits”) are allowed to be removed.

  • protocols (bool, optional) – Whether protocol objects are allowed to be removed.

  • children (bool, optional) – Whether child objects of TreeNode objects are allowed to be removed.

Methods

__init__([edesigns, data, results, ...])

cast(obj[, root_cls_being_deleted])

Create a RecursiveRemovalSpecification object from another object.

classmethod cast(obj, root_cls_being_deleted=None)#

Create a RecursiveRemovalSpecification object from another object.

If obj is already a RecursiveRemovalSpecification object then it is just returned directly. Otherwise, obj can be a string, boolean value, or None:

  • False, None, or “none”: no objects are removed recursively (the safe option)

  • True or “all”: all recursive removal operation are permitted (the un-safe option)

  • “default”: only recursive removal of the type being removed is allowed. For example,

    when removing a ProtocolData object, it and any child ProtocolData objects are removed but experiment designs are not, nor are (potentially shared) circuits.

  • “upstream”: recursive removal of the type being removed and “upstream” types is allowed. “Upstream”

    refers to items closer to the front of the list: experiment designs, data objects, result objects. For example, when removing a ProtocolData object, it and any child ProtocolData objects, along with their experiment designs are removed, but circuit objects are not.

  • “all_but_circuits”: everything but circuit objects are allowed to be removed. Circuit objects are

    treated specially because they are very likely to be re-used (shared).

Parameters:
  • obj (object) – The object to convert. See description above.

  • root_cls_being_deleted (class, optional) – The Python class of the main object being deleted. This additional information is needed when (and only when) obj == “default”.

Return type:

RecursiveRemovalSpecification