How to use the autoprotocol.container.Container function in autoprotocol

To help you get started, we’ve selected a few autoprotocol examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github autoprotocol / autoprotocol-python / autoprotocol / builders.py View on Github external
Returns
        -------
        dict
            mag_dry parameters

        Raises
        ------
        TypeError
            If `object` is not a Container

        See Also
        --------
        Protocol.mag_dry

        """
        if not isinstance(object, Container):
            raise TypeError(f"object: {object} is not a Container")
        duration = parse_unit(duration, "seconds")
        return {"object": object, "duration": duration}
github autoprotocol / autoprotocol-python / autoprotocol / builders.py View on Github external
Raises
        ------
        TypeError
            If `object` is not a Container
        TypeError
            If `cycles` is not an int
        ValueError
            If `bottom_position` is not a positive number

        See Also
        --------
        Protocol.mag_collect

        """
        if not isinstance(object, Container):
            raise TypeError(f"object: {object} is not a Container")
        if not isinstance(cycles, int):
            raise TypeError(f"cycles: {cycles} is not an int")
        pause_duration = parse_unit(pause_duration, "seconds")
        bottom_position = float(bottom_position)
        if bottom_position < 0:
            raise ValueError(f"bottom_position: {bottom_position} must be >= 0")
        if temperature is not None:
            parse_unit(temperature, "celsius")
        return {
            "object": object,
            "cycles": cycles,
            "pause_duration": pause_duration,
            "bottom_position": bottom_position,
            "temperature": temperature,
        }
github autoprotocol / autoprotocol-python / autoprotocol / protocol.py View on Github external
Parameters
        ----------
        container : Container
            Container used within this protocol
        condition : str
            New storage destiny for the specified Container

        Raises
        ------
        TypeError
            If container argument is not a Container object
        RuntimeError
            If the container passed is not already present in self.refs

        """
        if not isinstance(container, Container):
            raise TypeError("Protocol.store() can only be used on a Container object.")
        container.storage = condition
        r = self.refs.get(container.name)
        if not r:
            raise RuntimeError("That container does not exist in the refs for this protocol.")
        if "discard" in r.opts:
            r.opts.pop("discard")
        r.opts["store"] = {"where": str(condition)}
github autoprotocol / autoprotocol-python / autoprotocol / protocol.py View on Github external
if id and cont_type:
              opts["id"] = id
          elif cont_type:
              opts["new"] = cont_type.shortname
        except ValueError:
          raise RuntimeError("You must specify a ref's container type.")


        if storage:
            opts["store"] = {"where": storage}
        elif discard and not storage:
            opts["discard"] = discard
        else:
            raise RuntimeError("You must specify either a valid storage "
                             "condition or set discard=True for a Ref.")
        container = Container(id, cont_type, name=name, storage=storage if storage else None)
        self.refs[name] = Ref(name, opts, container)
        return container