Check layered architecture.

        Args:
            dsm (:class:`DesignStructureMatrix`): the DSM to check.

        Returns:
            bool, str: True if layered architecture else False, messages
774936
def check(self, dsm, **kwargs):
        
        layered_architecture = True
        messages = []
        categories = dsm.categories
        dsm_size = dsm.size[0]

        if not categories:
            categories = ['appmodule'] * dsm_size

        for i in range(0, dsm_size - 1):
            for j in range(i + 1, dsm_size):
                if (categories[i] != 'broker' and
                        categories[j] != 'broker' and
                        dsm.entities[i].split('.')[0] != dsm.entities[j].split('.')[0]):  # noqa
                    if dsm.data[i][j] > 0:
                        layered_architecture = False
                        messages.append(
                            'Dependency from %s to %s breaks the '
                            'layered architecture.' % (
                                dsm.entities[i], dsm.entities[j]))

        return layered_architecture, '\n'.join(messages)
970967
def check_thickness(s):
    

    s = check_1d(s, "thickness")
    if any(map(lambda d: d <= 0, s)):
        raise Exception('Thickness cannot be 0 or negative')

    return s
965178
private boolean checkmArcs(List<Integer> mArcsT, int neighborBondNumA, int neighborBondNumB) {

        int size = neighborBondNumA * neighborBondNumA;
        List<Integer> posNumList = new ArrayList<Integer>(size);

        for (int i = 0; i < posNumList.size(); i++) {
            posNumList.add(i, 0);
        }

        int yCounter = 0;
        int countEntries = 0;
        for (int x = 0; x < (neighborBondNumA * neighborBondNumB); x++) {
            if (mArcsT.get(x) == 1) {
                posNumList.add(yCounter++, x);
                countEntries++;
            }
        }
        boolean flag = false;

        verifyNodes(posNumList, first, 0, countEntries);
        if (isNewMatrix()) {
            flag = true;
        }

        return flag;

    }
511599
def _validate_number_of_layers(self, number_of_layers):
        

        # Only positive numbers are correct
        if number_of_layers <= 0:
            raise SquashError(
                "Number of layers to squash cannot be less or equal 0, provided: %s" % number_of_layers)

        # Do not squash if provided number of layer to squash is bigger
        # than number of actual layers in the image
        if number_of_layers > len(self.old_image_layers):
            raise SquashError(
                "Cannot squash %s layers, the %s image contains only %s layers" % (number_of_layers, self.image, len(self.old_image_layers)))
110492
public static boolean isSameStructure(DMatrixSparseCSC a , DMatrixSparseCSC b) {
        if( a.numRows == b.numRows && a.numCols == b.numCols && a.nz_length == b.nz_length) {
            for (int i = 0; i <= a.numCols; i++) {
                if( a.col_idx[i] != b.col_idx[i] )
                    return false;
            }
            for (int i = 0; i < a.nz_length; i++) {
                if( a.nz_rows[i] != b.nz_rows[i] )
                    return false;
            }
            return true;
        }
        return false;
    }
1371755
def has_valid_soma(data_wrapper):
    '''
    '''
    try:
        make_soma(data_wrapper.soma_points())
        return CheckResult(True)
    except SomaError:
        return CheckResult(False)
524879
def cublasDtrsm(handle, side, uplo, trans, diag, m, n, alpha, A, lda, B, ldb):
    
    
    status = _libcublas.cublasDtrsm_v2(handle, 
                                       _CUBLAS_SIDE_MODE[side], 
                                       _CUBLAS_FILL_MODE[uplo], 
                                       _CUBLAS_OP[trans], 
                                       _CUBLAS_DIAG[diag], 
                                       m, n, ctypes.byref(ctypes.c_double(alpha)),
                                       int(A), lda, int(B), ldb)
    cublasCheckStatus(status)
1318216
def is_legal(self, layers=None):
        '''
        
        '''
        if layers is None:
            layers = self.layers

        for layer in layers:
            if layer.is_delete is False:
                if len(layer.input) != layer.input_size:
                    return False
                if len(layer.output) < layer.output_size:
                    return False

        # layer_num <= max_layer_num
        if self.layer_num(layers) > self.max_layer_num:
            return False

        # There is loop in graph || some layers can't to arrive
        if self.is_topology(layers) is False:
            return False

        return True
1154778
def has_netmask(interface_name):
    
    for interface in interfaces():
        if interface["name"] == interface_name:
            if interface["netmask"] and len(interface["netmask"]) > 0:
                return True
            return False
    return False
675921
def check(self, defn, msg=None):
        
        if isinstance(defn.type, dtype.PrimitiveType):
            # Check the nbytes designated in the YAML match the PDT
            nbytes = defn.type.nbytes
            defnbytes = defn.slice().stop - defn.slice().start
            if nbytes != defnbytes:
                self.messages.append(self.msg % defn.name)
                self.messages.append("Definition size of (" + str(defnbytes) +
                                     " bytes) does not match size of data" +
                                     " type " +str(defn.type.name) + " (" +
                                     str(nbytes) + " byte(s))")
                # TODO self.messages.append("TBD location message")
                self.valid = False
65024
def check_available(self):
        
        success = True
        start_time = datetime.datetime.utcnow()
        message = ''
        LOGGER.debug('Checking layer id %s' % self.id)

        signals.post_save.disconnect(layer_post_save, sender=Layer)

        try:
            self.update_thumbnail()
        except ValueError, err:
            # caused by update_thumbnail()
            # self.href is empty in arcserver.ExportMap
            if str(err).startswith("unknown url type:"):
                LOGGER.debug('Thumbnail can not be updated: %s' % str(err))
        except Exception, err:
            message = str(err)
            success = False

        signals.post_save.connect(layer_post_save, sender=Layer)

        end_time = datetime.datetime.utcnow()

        delta = end_time - start_time
        response_time = '%s.%s' % (delta.seconds, delta.microseconds)

        check = Check(
            content_object=self,
            success=success,
            response_time=response_time,
            message=message
        )
        check.save()
        LOGGER.debug('Layer checked in %s seconds, status is %s' % (response_time, success))
        return success, message
772814
def IsComposite(self):
    
    return bool(self.condition) or (
        self.member_data_type_definition and
        self.member_data_type_definition.IsComposite())
1240608
def _check_state(self):
        
        if(self.grid is not None and
           self.configs.configs is not None and
           self.assignments['forward_model'] is not None):
            self.can_model = True

        if(self.grid is not None and
           self.assignments['measurements'] is not None):
            self.can_invert = True
39153
def check_data(self, *args, **kwargs):
        
        plotter_cls = self.plotter_cls
        da_list = self._project_plotter._da.psy.to_interactive_list()
        return plotter_cls.check_data(
            da_list.all_names, da_list.all_dims, da_list.is_unstructured)
56535
async def check(self, message: types.Message):
        
        check = await super(CommandStart, self).check(message)

        if check and self.deep_link is not None:
            if not isinstance(self.deep_link, re.Pattern):
                return message.get_args() == self.deep_link

            match = self.deep_link.match(message.get_args())
            if match:
                return {'deep_link': match}
            return False

        return check
32348
def check_state(self, state):
        

        if state.addr == self.function.addr:
            arch = state.arch
            if self._check_arguments(arch, state):
                return True

        return False
591983
def _is_mosaic(dicom_input):
    
    # for grouped dicoms
    if type(dicom_input) is list and type(dicom_input[0]) is list:
        header = dicom_input[0][0]
    else:  # all the others
        header = dicom_input[0]

    # check if image type contains m and mosaic
    if 'ImageType' not in header or 'MOSAIC' not in header.ImageType:
        return False

    if 'AcquisitionMatrix' not in header or header.AcquisitionMatrix is None:
        return False

    return True