Convert to a `RackController` object.

        `node_type` must be `NodeType.RACK_CONTROLLER` or
        `NodeType.REGION_AND_RACK_CONTROLLER`.
970522
def as_rack_controller(self):
        
        if self.node_type not in [
                NodeType.RACK_CONTROLLER, NodeType.REGION_AND_RACK_CONTROLLER]:
            raise ValueError(
                'Cannot convert to `RackController`, node_type is not a '
                'rack controller.')
        return self._origin.RackController(self._data)
215512
def convert(self, value, _type):
        
        return self.type_convertors.get(_type, lambda x: x)(value)
1198124
public NodeTypes getNodeTypes() {
        String url = jsonRestClient.appendToURL(ITEMS_METHOD, NODE_TYPES_SEGMENT);
        JSONRestClient.Response response = jsonRestClient.doGet(url);
        if (!response.isOK()) {
            throw new RuntimeException(JdbcI18n.invalidServerResponse.text(url, response.asString()));
        }
        return new NodeTypes(response.json());
    }
1003168
def call(rack_env)
      begin
        env = {}
        bad_route = route_request(rack_env, env)
        return error_response(bad_route, env) if bad_route

        @before.each do |hook|
          result = hook.call(rack_env, env)
          return error_response(result, env) if result.is_a? Twirp::Error
        end

        output = call_handler(env)
        return error_response(output, env) if output.is_a? Twirp::Error
        return success_response(output, env)

      rescue => e
        raise e if self.class.raise_exceptions
        begin
          @exception_raised.each{|hook| hook.call(e, env) }
        rescue => hook_e
          e = hook_e
        end

        twerr = Twirp::Error.internal_with(e)
        return error_response(twerr, env)
      end
    end
1034332
def rackconnect(vm_):
    '''
    
    '''
    return config.get_cloud_config_value(
        'rackconnect', vm_, __opts__, default=False,
        search_global=False
    )
1134174
def from_ast(
        pyast_node, node=None, node_cls=None, Node=Node,
        iter_fields=ast.iter_fields, AST=ast.AST):
    '''
    '''
    node_cls = node_cls or Node
    node = node or node_cls()
    name = pyast_node.__class__.__name__

    attrs = []
    for field, value in iter_fields(pyast_node):
        if name == 'Dict':
            for key, value in zip(pyast_node.keys, pyast_node.values):
                if isinstance(value, list):
                    for item in value:
                        if isinstance(item, AST):
                            value = from_ast(item)
                elif isinstance(value, AST):
                    value = from_ast(value)
                attrs.append((key.s, value))
        else:
            if isinstance(value, list):
                for item in value:
                    if isinstance(item, AST):
                        value = from_ast(item)
            elif isinstance(value, AST):
                value = from_ast(value)
            attrs.append((field, value))
    node.update(attrs, type=name)
    return node
1177036
@Override
	public Object convert(Object source) {

		NodeInterface relatedNode = getRelatedNode(true);
		if (relatedNode != null) {

			try {
				
				relatedNode.setProperty(targetKey, source);
				
			} catch (FrameworkException fex) {

				logger.warn("Unable to set remote node property {}", targetKey);
			}
		}
		
		return null;
	}
67461
def Convert(self, metadata, conn, token=None):
    """"""

    result = ExportedNetworkConnection(
        metadata=metadata,
        family=conn.family,
        type=conn.type,
        local_address=conn.local_address,
        remote_address=conn.remote_address,
        state=conn.state,
        pid=conn.pid,
        ctime=conn.ctime)
    return [result]
1372604
def as_device(self):
        
        if self.node_type != NodeType.DEVICE:
            raise ValueError(
                'Cannot convert to `Device`, node_type is not a device.')
        return self._origin.Device(self._data)
1024412
def convert(self):
        

        if self.is_type():
            return self.force_convert()

        raise TypeConversionError(
            "failed to convert from {} to {}".format(type(self._data).__name__, self.typename)
        )
502817
def convert_frame_to_node(pyvlx, frame):
    """"""
    # pylint: disable=too-many-return-statements
    if frame.node_type == NodeTypeWithSubtype.WINDOW_OPENER:
        return Window(pyvlx=pyvlx, node_id=frame.node_id, name=frame.name, rain_sensor=False)
    if frame.node_type == NodeTypeWithSubtype.WINDOW_OPENER_WITH_RAIN_SENSOR:
        return Window(pyvlx=pyvlx, node_id=frame.node_id, name=frame.name, rain_sensor=True)
    if frame.node_type == NodeTypeWithSubtype.ROLLER_SHUTTER or \
            frame.node_type == NodeTypeWithSubtype.DUAL_ROLLER_SHUTTER:
        return RollerShutter(pyvlx=pyvlx, node_id=frame.node_id, name=frame.name)
    if frame.node_type == NodeTypeWithSubtype.INTERIOR_VENETIAN_BLIND or \
            frame.node_type == NodeTypeWithSubtype.VERTICAL_INTERIOR_BLINDS or \
            frame.node_type == NodeTypeWithSubtype.EXTERIOR_VENETIAN_BLIND or \
            frame.node_type == NodeTypeWithSubtype.LOUVER_BLIND:
        return Blind(pyvlx=pyvlx, node_id=frame.node_id, name=frame.name)
    if frame.node_type == NodeTypeWithSubtype.VERTICAL_EXTERIOR_AWNING or \
            frame.node_type == NodeTypeWithSubtype.HORIZONTAL_AWNING:
        return Awning(pyvlx=pyvlx, node_id=frame.node_id, name=frame.name)
    if frame.node_type == NodeTypeWithSubtype.ON_OFF_SWITCH:
        return OnOffSwitch(pyvlx=pyvlx, node_id=frame.node_id, name=frame.name)

    PYVLXLOG.warning("%s not implemented", frame.node_type)
    return None
70081
def serialize(self,
                  node: SchemaNode,
                  appstruct: Union[PotentialDatetimeType,
                                   ColanderNullType]) \
            -> Union[str, ColanderNullType]:
        
        if not appstruct:
            return colander.null
        try:
            appstruct = coerce_to_pendulum(appstruct,
                                           assume_local=self.use_local_tz)
        except (ValueError, ParserError) as e:
            raise Invalid(
                node,
                "{!r} is not a pendulum.DateTime object; error was "
                "{!r}".format(appstruct, e))
        return appstruct.isoformat()
1061109
def as_machine(self):
        
        if self.node_type != NodeType.MACHINE:
            raise ValueError(
                'Cannot convert to `Machine`, node_type is not a machine.')
        return self._origin.Machine(self._data)
651427
def _make_instance(self, node_data):
        
        node_data['from_db'] = self._from_db
        clone = self.__call__(**node_data)
        clone.setattrs(container = self,
                    _is_item = True)
        for name in self._nodes:
            _name = un_camel(name)
            if _name in node_data:  # check for partial data
                getattr(clone, name)._load_data(node_data[_name])
        _key = clone._get_linked_model_key()
        if _key:
            self.node_dict[_key] = clone
        return clone
496963
def controller
      unless params[:controller]
        raise ControllerExceptions::NotFound,
          "Route matched, but route did not specify a controller.\n" +
          "Did you forgot to add :controller => \"people\" or :controller " +
          "segment to route definition?\nHere is what's specified:\n" +
          route.inspect
      end
      path = [params[:namespace], params[:controller]].compact.join(Merb::Const::SLASH)
      controller = path.snake_case.to_const_string

      begin
        Object.full_const_get(controller)
      rescue NameError => e
        msg = "Controller class not found for controller `#{path}'"
        Merb.logger.warn!(msg)
        raise ControllerExceptions::NotFound, msg
      end
    end
654351
def _convert_qemu_node(node, old_node):
    

    # In 2.0 the internet VM is replaced by the NAT node
    if old_node.get("properties", {}).get("hda_disk_image_md5sum") == "8ebc5a6ec53a1c05b7aa101b5ceefe31":
        node["console"] = None
        node["console_type"] = None
        node["node_type"] = "nat"
        del old_node["properties"]
        node["properties"] = {
            "ports": [
                {
                    "interface": "eth1",
                    "name": "nat0",
                    "port_number": 0,
                    "type": "ethernet"
                }
            ]
        }
        if node["symbol"] is None:
            node["symbol"] = ":/symbols/cloud.svg"
        return node

    node["node_type"] = "qemu"
    if node["symbol"] is None:
        node["symbol"] = ":/symbols/qemu_guest.svg"
    return node
657613
def to_app # :nodoc:
      Rack::Builder.new.tap do |app|
        app.use Middleware::Static, machined.output_path
        app.use Middleware::RootIndex
        app.run Rack::URLMap.new(sprockets_map)
      end
    end