Check mdp and return True it's ok
559511
def loggin(self, user_id, mdp, autolog):
        """"""
        r = sql.abstractRequetesSQL.check_mdp_user(user_id, mdp)
        if r():
            # update auto-log params
            self.autolog[user_id] = autolog and mdp or False
            self.modules = self.users[user_id]["modules"]  # load modules list

            dic = {"autolog": self.autolog, "modules": self.modules}
            s = json.dumps(dic, indent=4, ensure_ascii=False)
            b = security.protege_data(s, True)
            with open("local/init", "wb") as f:
                f.write(b)

            self.mode_online = True  # authorization to execute bakground tasks
            return True
        else:
            logging.debug("Bad password !")
146094
def _check(self, accepted):
        """"""
        # logging.debug('A check is now happening...')
        # for key in self.statediag[1].trans:
        #    logging.debug('transition to '+`key`+" with "+self.statediag[1].trans[key][0])
        total = []
        if 1 in self.quickresponse:
            total = total + self.quickresponse[1]
        if (1, 0) in self.quickresponse:
            total = total + self.quickresponse[(1, 0)]
        for key in total:
            if (key.id == 1 or key.id == (1, 0)) and key.type == 3:
                if accepted is None:
                    if 2 in key.trans:
                        # print 'Found'
                        return key.trans[2]
                else:
                    for state in accepted:
                        if (2, state) in key.trans:
                            # print 'Found'
                            return key.trans[(2, state)]
        return -1
244533
def check_simple(self, checks, radl):
        """"""

        for f in self.features:
            if not isinstance(f, Feature) or f.prop not in checks:
                continue
            f._check(checks[f.prop], radl)
342950
def _check(self):
        
        if conf.contribs['LLDP'].strict_mode() and self._length != 2:
            raise LLDPInvalidLengthField('length must be 2 - got '
                                         '{}'.format(self._length))
797751
def is_sample_set(self, md5):
        
        try:
            self.get_sample_set(md5)
            return True
        except WorkBench.DataNotFound:
            return False
1102534
def isDone(self):
        """"""
        done = pydaq.bool32()
        self.IsTaskDone(ctypes.byref(done))
        return done.value
1134216
function checkOlderIE() {
  const ua = navigator.userAgent;
  const isIE = ua.indexOf('MSIE') !== -1 || ua.indexOf('Trident') !== -1;
  if (!isIE) {
    return false;
  }
  const version = ua.match(/(MSIE\s|Trident.*rv:)([\w.]+)/)[2];
  const versionNumber = parseFloat(version);
  if (versionNumber < 10) {
    return true;
  }
  return false;
}
102087
def check(self):
        """"""

        if len(self.status_datasets) == 0:
            return False
        if all(self.status_datasets):
            return True
        return False
532615
def check_if_needs_modeling(tomodir):
    
    print('check for modeling', tomodir)
    required_files = (
        'config' + os.sep + 'config.dat',
        'rho' + os.sep + 'rho.dat',
        'grid' + os.sep + 'elem.dat',
        'grid' + os.sep + 'elec.dat',
        'exe' + os.sep + 'crmod.cfg',
    )

    not_allowed = (
        'mod' + os.sep + 'volt.dat',
    )
    needs_modeling = True
    for filename in not_allowed:
        if os.path.isfile(tomodir + os.sep + filename):
            needs_modeling = False

    for filename in required_files:
        full_file = tomodir + os.sep + filename
        if not os.path.isfile(full_file):
            print('does not exist: ', full_file)
            needs_modeling = False

    return needs_modeling
497358
def check_valid_device(self, path, run_as_root=True):
        """"""
        if self.im_root:
            try:
                with open(path, 'r') as f:
                    f.read(4096)
            except Exception:
                return False
            return True

        try:
            self._execute('dd', 'if=' + path, 'of=/dev/null', 'bs=4096',
                          'count=1', root_helper=self._root_helper,
                          run_as_root=True)
        except putils.ProcessExecutionError:
            return False
        return True
1140427
def _check(self): # TODO: fix?
        """"""
        if self._returncode:
            rarfile.check_returncode(self, '')
        if self._remain != 0:
            raise rarfile.BadRarFile("Failed the read enough data")
538216
function _checkData(modbus, buf) {
    // check buffer size
    if (buf.length !== modbus._length && buf.length !== 5) {
        modbusSerialDebug({ action: "length error", recive: buf.length, expected: modbus._length });

        return false;
    }

    // check buffer unit-id and command
    return (buf[0] === modbus._id &&
        (0x7f & buf[1]) === modbus._cmd);
}
1309020
def valid():
    '''
    
    '''
    m_data = __salt__['config.merge']('mine_functions', {})
    # If we don't have any mine functions configured, then we should just bail out
    if not m_data:
        return

    data = {}
    for func in m_data:
        if m_data[func] and isinstance(m_data[func], dict):
            mine_func = m_data[func].pop('mine_function', func)
            if not _mine_function_available(mine_func):
                continue
            data[func] = {mine_func: m_data[func]}
        elif m_data[func] and isinstance(m_data[func], list):
            mine_func = func
            if isinstance(m_data[func][0], dict) and 'mine_function' in m_data[func][0]:
                mine_func = m_data[func][0]['mine_function']
                m_data[func].pop(0)

            if not _mine_function_available(mine_func):
                continue
            data[func] = {mine_func: m_data[func]}
        else:
            if not _mine_function_available(func):
                continue
            data[func] = m_data[func]

    return data
503825
private void checkAnyChunk(long p) {
    if (VALIDATING) {
      if (!isAligned(chunkToMem(p)))
        throw new AssertionError("Chunk address [mem:" + p + "=>chunk:" + chunkToMem(p) + "] is incorrectly aligned");
      if (!okAddress(p))
        throw new AssertionError("Memory address " + p + " is invalid");
    }
  }
914822
def check(self, value, major):
        """"""
        for v in value:
            super(DiscreteMulti, self).check(v, major)
198262
def is_valid(self, qstr=None):
        """"""
        if qstr is None:
            qstr = self.currentText()
        return osp.isfile(to_text_string(qstr))
764407
def _valid_packet(raw_packet):
        """"""
        if raw_packet[0:1] != b'\xcc':
            return False
        if len(raw_packet) != 19:
            return False
        checksum = 0
        for i in range(1, 17):
            checksum += raw_packet[i]
        if checksum != raw_packet[18]:
            return False
        return True