:param function_logical_id: logical_id of the function this deployment group belongs to
        :return: CodeDeployDeploymentGroup resource
358747
def deployment_group(self, function_logical_id):
        
        deployment_preference = self.get(function_logical_id)

        deployment_group = CodeDeployDeploymentGroup(self.deployment_group_logical_id(function_logical_id))

        if deployment_preference.alarms is not None:
            deployment_group.AlarmConfiguration = {'Enabled': True,
                                                   'Alarms': [{'Name': alarm} for alarm in
                                                              deployment_preference.alarms]}

        deployment_group.ApplicationName = self.codedeploy_application.get_runtime_attr('name')
        deployment_group.AutoRollbackConfiguration = {'Enabled': True,
                                                      'Events': ['DEPLOYMENT_FAILURE',
                                                                 'DEPLOYMENT_STOP_ON_ALARM',
                                                                 'DEPLOYMENT_STOP_ON_REQUEST']}
        deployment_group.DeploymentConfigName = fnSub("CodeDeployDefault.Lambda${ConfigName}",
                                                      {"ConfigName": deployment_preference.deployment_type})
        deployment_group.DeploymentStyle = {'DeploymentType': 'BLUE_GREEN',
                                            'DeploymentOption': 'WITH_TRAFFIC_CONTROL'}

        deployment_group.ServiceRoleArn = self.codedeploy_iam_role.get_runtime_attr("arn")
        if deployment_preference.role:
            deployment_group.ServiceRoleArn = deployment_preference.role

        return deployment_group
203696
def from_dict(cls, logical_id, deployment_preference_dict):
        
        enabled = deployment_preference_dict.get('Enabled', True)
        if not enabled:
            return DeploymentPreference(None, None, None, None, False, None)

        if 'Type' not in deployment_preference_dict:
            raise InvalidResourceException(logical_id, "'DeploymentPreference' is missing required Property 'Type'")

        deployment_type = deployment_preference_dict['Type']
        hooks = deployment_preference_dict.get('Hooks', dict())
        if not isinstance(hooks, dict):
            raise InvalidResourceException(logical_id,
                                           "'Hooks' property of 'DeploymentPreference' must be a dictionary")

        pre_traffic_hook = hooks.get('PreTraffic', None)
        post_traffic_hook = hooks.get('PostTraffic', None)
        alarms = deployment_preference_dict.get('Alarms', None)
        role = deployment_preference_dict.get('Role', None)
        return DeploymentPreference(deployment_type, pre_traffic_hook, post_traffic_hook, alarms, enabled, role)
206097
def do_set_logical_switch_config(self, line):
        

        def f(p, args):
            try:
                target, lsw, key, value = args
            except:
                print("argument error")
                return

            # get switch id
            o = p.get_config(target)
            capable_switch_id = o.id

            try:
                capable_switch = ofc.OFCapableSwitchType(
                    id=capable_switch_id,
                    logical_switches=ofc.OFCapableSwitchLogicalSwitchesType(
                        switch=[ofc.OFLogicalSwitchType(
                            id=lsw,
                            **{key: value}
                        )]
                    )
                )
            except TypeError:
                print("argument error")
                return
            try:
                p.edit_config(target, capable_switch)
            except Exception as e:
                print(e)

        self._request(line, f)
637223
def id_(reset=False):
    '''
    
    '''
    if reset:
        id_pattern = re.compile(r'Monit id (?P<id>[^ ]+)')
        cmd = 'echo y|monit -r'
        out = __salt__['cmd.run_all'](cmd, python_shell=True)
        ret = id_pattern.search(out['stdout']).group('id')
        return ret if ret else False
    else:
        cmd = 'monit -i'
        out = __salt__['cmd.run'](cmd)
        ret = out.split(':')[-1].strip()
    return ret
1183938
def _get_function_id(self):
        
        if self.is_for_driver_task:
            return ray.FunctionID.nil()
        function_id_hash = hashlib.sha1()
        # Include the function module and name in the hash.
        function_id_hash.update(self.module_name.encode("ascii"))
        function_id_hash.update(self.function_name.encode("ascii"))
        function_id_hash.update(self.class_name.encode("ascii"))
        function_id_hash.update(self._function_source_hash)
        # Compute the function ID.
        function_id = function_id_hash.digest()
        return ray.FunctionID(function_id)
140432
def loadScopeGroupbyID(self, id, callback=None, errback=None):
        
        import ns1.ipam
        scope_group = ns1.ipam.Scopegroup(self.config, id=id)
        return scope_group.load(callback=callback, errback=errback)
168515
def function_table(self, function_id=None):
        
        self._check_connected()
        function_table_keys = self.redis_client.keys(
            ray.gcs_utils.FUNCTION_PREFIX + "*")
        results = {}
        for key in function_table_keys:
            info = self.redis_client.hgetall(key)
            function_info_parsed = {
                "DriverID": binary_to_hex(info[b"driver_id"]),
                "Module": decode(info[b"module"]),
                "Name": decode(info[b"name"])
            }
            results[binary_to_hex(info[b"function_id"])] = function_info_parsed
        return results
664754
def get_function_id(self):
        
        # Implemented from template for osid.learning.Activity.get_objective_id
        if not bool(self._my_map['functionId']):
            raise errors.IllegalState('function empty')
        return Id(self._my_map['functionId'])
653974
def _construct_target(self, function):
        
        target = {
                'Arn': function.get_runtime_attr("arn"),
                'Id': self.logical_id + 'LambdaTarget'
        }
        if self.Input is not None:
            target['Input'] = self.Input

        if self.InputPath is not None:
            target['InputPath'] = self.InputPath
        return target
39433
public Activity getActivityById(String logicalId) {
        for (Activity activityVO : getActivities()) {
            if (activityVO.getLogicalId().equals(logicalId)) {
                activityVO.setProcessName(getName());
                return activityVO;
            }
        }
        for (Process subProc : this.subprocesses) {
            for (Activity activityVO : subProc.getActivities()) {
                if (activityVO.getLogicalId().equals(logicalId)) {
                    activityVO.setProcessName(getName() + ":" + subProc.getName());
                    return activityVO;
                }
            }
        }

        return null;
    }
1000471
def do_get_logical_switch_config(self, line):
        

        def f(p, args):
            try:
                source, lsw = args
            except:
                print("argument error")
                return
            o = p.get_config(source)
            for l in o.logical_switches.switch:
                if l.id != lsw:
                    continue
                print(l.id)
                for k in self._lsw_settings:
                    try:
                        v = getattr(l, k)
                    except AttributeError:
                        continue
                    print('%s %s' % (k, v))

        self._request(line, f)
688233
def _get_deployment_instance_summary(awsclient, deployment_id, instance_id):
    
    client_codedeploy = awsclient.get_client('codedeploy')
    request = {
        'deploymentId': deployment_id,
        'instanceId': instance_id
    }
    response = client_codedeploy.get_deployment_instance(**request)
    return response['instanceSummary']['status'], \
           response['instanceSummary']['lifecycleEvents'][-1]['lifecycleEventName']
489474
function ( arg ) {
		var id;

		if ( arg === global ) {
			id = "window";
		}
		else if ( !server && arg === document ) {
			id = "document";
		}
		else if ( !server && arg === document.body ) {
			id = "body";
		}
		else {
			utility.genId( arg );
			id = arg.id || ( typeof arg.toString === "function" ? arg.toString() : arg );
		}

		return id;
	}
361912
def deploy(func_or_name, data_defaults=None):
    '''
    
    '''

    # If not decorating, return function with config attached
    if isinstance(func_or_name, six.string_types):
        name = func_or_name

        def decorator(f):
            setattr(f, 'deploy_name', name)

            if data_defaults:
                setattr(f, 'deploy_data', data_defaults)

            return deploy(f)

        return decorator

    # Actually decorate!
    func = func_or_name

    @wraps(func)
    def decorated_func(*args, **kwargs):
        # If we're in CLI mode, there's no state/host passed down, we need to
        # use the global "pseudo" modules.
        if len(args) < 2 or not (
            isinstance(args[0], (State, PseudoModule))
            and isinstance(args[1], (Host, PseudoModule))
        ):
            state = pseudo_state._module
            host = pseudo_host._module

            if state.in_deploy:
                raise PyinfraError((
                    'Nested deploy called without state/host: {0}'
                ).format(func))

        # Otherwise (API mode) we just trim off the commands
        else:
            args_copy = list(args)
            state, host = args[0], args[1]
            args = args_copy[2:]

        # In API mode we have the kwarg - if a nested deploy we actually
        # want the frame of the caller (ie inside the deploy package).
        frameinfo = kwargs.pop('frameinfo', get_caller_frameinfo())
        logger.debug('Adding deploy, called @ {0}:{1}'.format(
            frameinfo.filename, frameinfo.lineno,
        ))

        deploy_kwargs = pop_op_kwargs(state, kwargs)

        # Name the deploy
        deploy_name = getattr(func, 'deploy_name', func.__name__)
        deploy_data = getattr(func, 'deploy_data', None)

        with state.deploy(deploy_name, deploy_kwargs, deploy_data, frameinfo.lineno):
            # Execute the deploy, passing state and host
            func(state, host, *args, **kwargs)

    return decorated_func
542261
function getDeployments(auth, projectId) {
    return new Promise((resolve, reject) => {
        const script = google.script('v1');
        script.projects.deployments.list({
            auth,
            scriptId: projectId,
        }, (error, deployments) => {
            if (error) {
                triageGoogleError(error, 'getDeployments').then((triaged) => {
                    reject(triaged);
                }).catch((notTriaged) => {
                    reject(notTriaged);
                });
            } else {
                resolve(deployments.data);
            }
            return;
        });
    });
}
522207
def logical_xor(f1, f2):  # function factory
    '''
    '''
    def f(value):
        return np.logical_xor(f1(value), f2(value))
    f.__name__ = "(" + f1.__name__ + "_xor_" + f2.__name__ + ")"
    return f
811905
async def fetch_logical_load(self, llid):
        """"""
        url = "https://production.plum.technology/v2/getLogicalLoad"
        data = {"llid": llid}
        return await self.__post(url, data)