Set machine constraints for this application.

        :param dict constraints: Dict of machine constraints
484440
async def set_constraints(self, constraints):
        
        app_facade = client.ApplicationFacade.from_connection(self.connection)

        log.debug(
            'Setting constraints for %s: %s', self.name, constraints)

        return await app_facade.SetConstraints(self.name, constraints)
345926
def check_constraints(self, instance):
        '''
        
        '''
        recalc_fields = []
        for constraint in self.constraints:
            try:
                constraint(self.model, instance)
            except constraints.InvalidConstraint as e:
                recalc_fields.extend(e.fields)
        return recalc_fields
677835
def constraints(self):
        
        try:
            return self._constraints
        except AttributeError:
            self._constraints = ConstraintDict()
            return self._constraints
876734
def constrain_property(self,prop,**kwargs):
        
        if prop not in self.constraints:
            self.constraints.append(prop)
        for pop in self.poplist:
            try:
                pop.constrain_property(prop,**kwargs)
            except AttributeError:
                logging.info('%s model does not have property stars.%s (constraint not applied)' % (pop.model,prop))
682755
def __set_hard_hard_constraints(self, tdata1, tdata2, seeds):
        
        seeds_mask = (seeds == 1) | (seeds == 3)
        tdata2[seeds_mask] = np.max(tdata2) + 1
        tdata1[seeds_mask] = 0

        seeds_mask = (seeds == 2) | (seeds == 4)
        tdata1[seeds_mask] = np.max(tdata1) + 1
        tdata2[seeds_mask] = 0

        return tdata1, tdata2
64890
def set_limits(self, min_=None, max_=None):
        
        self._min, self._max = min_, max_
450471
def add_constraints(self):
        
        if self._constraints:
            foreign_key = getattr(self._parent, self._foreign_key, None)
            if foreign_key is None:
                self._query = None
            else:
                table = self._related.get_table()

                self._query.where(
                    "{}.{}".format(table, self._other_key), "=", foreign_key
                )
1161760
def constrain_opts(self, constraint_dict, options):
        
        constraints = {}
        for constraint in constraint_dict:
            if constraint != 'self':
                if (constraint_dict[constraint] or
                        constraint_dict[constraint] == ''):
                    constraints[constraint] = constraint_dict[constraint]
        results = self.constrained_sections(constraints=constraints,
                                            options=options)
        return results, self.template
472609
def constraints_stmt(stmt, env=None):
    
    env = env or {}
    
    if isinstance(stmt, ast.FunctionDef):
        arg_env = fn_env(stmt.args)

        body_env = extended_env(env, arg_env)
        constraints = []
        return_type = None # TODO: should be fresh and constrained?
        for body_stmt in stmt.body:
            cs = constraints_stmt(body_stmt, env=body_env)
            body_env.update(cs.env)
            constraints += cs.constraints
            return_type = union(return_type, cs.return_type)

        env[stmt.name] = Function(arg_types=[arg_env[arg.id] for arg in stmt.args.args],
                                  return_type=return_type)

        return ConstrainedEnv(env=env, constraints=constraints)

    elif isinstance(stmt, ast.Expr):
        constrained_ty = constraints_expr(stmt.value, env=env)
        return ConstrainedEnv(env=env, constraints=constrained_ty.constraints)
        
    elif isinstance(stmt, ast.Return):
        if stmt.value:
            expr_result = constraints_expr(stmt.value, env=env)
            return ConstrainedEnv(env=env, constraints=expr_result.constraints, return_type=expr_result.type)
        else:
            result = fresh()
            return ConstrainedEnv(env=env, constraints=[Constraint(subtype=result, supertype=NamedType('NoneType'))])

    elif isinstance(stmt, ast.Assign):
        if len(stmt.targets) > 1:
            raise NotImplementedError('Cannot generate constraints for multi-target assignments yet')

        expr_result = constraints_expr(stmt.value, env=env)
        target = stmt.targets[0].id
        
        # For an assignment, we actually generate a fresh variable so that it can be the union of all things assigned
        # to it. We do not do any typestate funkiness.
        if target not in env:
            env[target] = fresh()
            
        return ConstrainedEnv(env=env, 
                              constraints = expr_result.constraints + [Constraint(subtype=expr_result.type, 
                                                                                  supertype=env[target])])

    else:
        raise NotImplementedError('Constraint gen for stmt %s' % stmt)
190463
def no_constraints(cls, with_subclasses=False):
        
        cls._constraints = False

        if with_subclasses:
            for klass in cls.__subclasses__():
                klass._constraints = False

        try:
            yield cls
        except Exception:
            raise
        finally:
            cls._constraints = True
            if with_subclasses:
                for klass in cls.__subclasses__():
                    klass._constraints = True
284554
def _validate_machines(machines, add_error):
    
    if not machines:
        return
    for machine_id, machine in machines.items():
        if machine_id < 0:
            add_error(
                'machine {} has an invalid id, must be positive digit'
                ''.format(machine_id))
        if machine is None:
            continue
        elif not isdict(machine):
            add_error(
                'machine {} does not appear to be well-formed'
                ''.format(machine_id))
            continue
        label = 'machine {}'.format(machine_id)
        _validate_constraints(machine.get('constraints'), label, add_error)
        _validate_series(machine.get('series'), label, add_error)
        _validate_annotations(machine.get('annotations'), label, add_error)
614626
public void setConstraints(Component component, CellConstraints constraints) {
        checkNotNull(component, "The component must not be null.");
        checkNotNull(constraints, "The constraints must not be null.");
        constraints.ensureValidGridBounds(getColumnCount(), getRowCount());
        constraintMap.put(component, (CellConstraints) constraints.clone());
    }
278457
async def SetConstraints(self, application, constraints):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Application',
                   request='SetConstraints',
                   version=8,
                   params=_params)
        _params['application'] = application
        _params['constraints'] = constraints
        reply = await self.rpc(msg)
        return reply
517810
def apply_default_constraints(self):
        
        try:
            self.apply_secthresh(pipeline_weaksec(self.koi))
        except NoWeakSecondaryError:
            logging.warning('No secondary eclipse threshold set for {}'.format(self.koi))
        self.set_maxrad(default_r_exclusion(self.koi))
875108
def satisfies_constraints(self, possible_solution):
        """"""
        for c in self._constraints:
            values = c.extract_values(possible_solution)
            if any(type(v) is NilObject for v in values) or not c(*values):
                return False
        return True
670808
def get_monotone_constraints(self):
        
        if self.monotone_constraints is None:
            self.monotone_constraints = self.get_field('monotone_constraints')
        return self.monotone_constraints
73476
def _validate_constraints(constraints, label, add_error):
    
    if constraints is None:
        return
    msg = '{} has invalid constraints {}'.format(label, constraints)
    if not isstring(constraints):
        add_error(msg)
        return
    sep = ',' if ',' in constraints else None
    for constraint in constraints.split(sep):
        try:
            key, value = constraint.split('=')
        except (TypeError, ValueError):
            add_error(msg)
            return
        if key not in _CONSTRAINTS:
            add_error(msg)