Check if the first sub-sequence of the new key sequence is valid.
172056
def check_singlekey(self):
        """"""
        if len(self._qsequences) == 0:
            return True
        else:
            keystr = self._qsequences[0]
            valid_single_keys = (EDITOR_SINGLE_KEYS if
                                 self.context == 'editor' else SINGLE_KEYS)
            if any((m in keystr for m in ('Ctrl', 'Alt', 'Shift', 'Meta'))):
                return True
            else:
                # This means that the the first subsequence is composed of
                # a single key with no modifier.
                valid_single_keys = (EDITOR_SINGLE_KEYS if
                                     self.context == 'editor' else SINGLE_KEYS)
                if any((k == keystr for k in valid_single_keys)):
                    return True
                else:
                    return False
354312
private static function _sequenceExists()
    {
        if (Driver::$primary_key_behaviour != Driver::PRIMARY_KEY_SEQUENCE) {
            return null;
        }

        // caching if the sequence exists
        $cls  = get_called_class();
        $name = self::resolveSequenceName();

        if (array_key_exists($cls, self::$_sequence_exists)
            && array_key_exists($name, self::$_sequence_exists[$cls])
        ) {
            return true;
        }

        $rtn = false;

        switch (Driver::$name) {
        case "oracle":
            $rtn = self::_oracleSequenceExists($name);
            break;
        case "postgresql":
            $rtn = self::_postgresqlSequenceExists($name);
            break;
        }

        // if exists, cache result
        if ($rtn) {
            if (!array_key_exists($cls, self::$_sequence_exists)) {
                self::$_sequence_exists[$cls] = array();
            }
            self::$_sequence_exists[$cls][$name] = true;
        }
        return $rtn;
    }
283018
def ensureKeysAreSetup(self):
        
        if not areKeysSetup(self.name, self.keys_dir):
            raise REx(REx.reason.format(self.name) + self.keygenScript)
36388
def match(self, seq, **kwargs):
        '''
        '''
        strict = kwargs.get('strict', False)
        top_level = kwargs.get('top_level', True)
        match = kwargs.get('match', list())

        if top_level:
            kwargs['top_level'] = False
            kwargs['match'] = match

            try:
                seq = IterableList(seq)
                self.match(seq, **kwargs)

                if strict:
                    if not seq.empty():
                        raise MatchFailed('Sequence is too long', seq)

            except MatchFailed as e:
                return e.failure()

            return Match(*match)

        for elem in self.elems:
            elem.match(seq, **kwargs)
1094875
def is_a_sequence(var, allow_none=False):
    
    return isinstance(var, (list, tuple)) or (var is None and allow_none)
1565
public static boolean verifySubset(Config superConfig, Config subConfig) {
    for (Map.Entry<String, ConfigValue> entry : subConfig.entrySet()) {
      if (!superConfig.hasPath(entry.getKey()) || !superConfig.getValue(entry.getKey()).unwrapped()
          .equals(entry.getValue().unwrapped())) {
        return false;
      }
    }
    return true;
  }
382324
def is_subsequence(short_seq, long_seq):
  """"""
  if not short_seq:
    return True
  pos = 0
  for x in long_seq:
    if pos == len(short_seq):
      return True
    if short_seq[pos] == x:
      pos += 1
  if pos == len(short_seq):
    return True
  return False
1006917
def is_sequential(self):
        
        seq_ids = tuple(int(residue["Seq_ID"]) for residue in self)
        return seq_ids == tuple(range(int(seq_ids[0]), int(seq_ids[-1])+1))
963061
def _validate_outgroup(self, outgroup):
        """"""
        if outgroup:
            outgroup = outgroup.replace("-", "_")
            good_outgroup = False
            for seq_record in self.seq_records:
                if seq_record.voucher_code == outgroup:
                    good_outgroup = True
                    break
            if good_outgroup:
                self.outgroup = outgroup
            else:
                raise ValueError("The given outgroup {0!r} cannot be found in the "
                                 "input sequence records.".format(outgroup))
        else:
            self.outgroup = None
174519
def verify_not_in(self, first, second, msg=""):
        
        try:
            self.assert_not_in(first, second, msg)
        except AssertionError, e:
            if msg:
                m = "%s:\n%s" % (msg, str(e))
            else:
                m = str(e)
            self.verification_erorrs.append(m)
482341
def _validate_mandatory_keys(mandatory, validated, data, to_validate):
    """"""
    errors = []
    for key, sub_schema in mandatory.items():
        if key not in data:
            errors.append('missing key: %r' % (key,))
            continue
        try:
            validated[key] = sub_schema(data[key])
        except NotValid as ex:
            errors.extend(['%r: %s' % (key, arg) for arg in ex.args])
        to_validate.remove(key)
    return errors
905312
function validateIdenticialTypedKeys (keyA, keyB) {
    if (keyA && typeof keyA === 'string' && keyB && typeof keyB === 'string') {
        const keyA_CNS = (keyA.charAt(0) === COMPOSITEKEY_NS);
        const keyB_CNS = (keyB.charAt(0) === COMPOSITEKEY_NS);
        if (keyA_CNS !== keyB_CNS) {
            throw new Error(`Keys are not of the same type (composite or simple) [${keyA}] [${keyB}]`);
        }
    }
}
45932
def should_check_ciphersuites(self):
        
        if isinstance(self.mykey, PrivKeyRSA):
            kx = "RSA"
        elif isinstance(self.mykey, PrivKeyECDSA):
            kx = "ECDSA"
        if get_usable_ciphersuites(self.cur_pkt.ciphers, kx):
            return
        raise self.NO_USABLE_CIPHERSUITE()
500501
public static boolean isEqualSeq(final String first, final String second, final String delimiter) {
    if (isNotEmpty(first) && isNotEmpty(second)) {
      String[] firstWords = split(first, delimiter);
      Set<String> firstSet = CollectUtils.newHashSet();
      for (int i = 0; i < firstWords.length; i++) {
        firstSet.add(firstWords[i]);
      }
      String[] secondWords = split(second, delimiter);
      Set<String> secondSet = CollectUtils.newHashSet();
      for (int i = 0; i < secondWords.length; i++) {
        secondSet.add(secondWords[i]);
      }
      return firstSet.equals(secondSet);
    } else {
      return isEmpty(first) & isEmpty(second);
    }
  }
273818
public void hasFirstKey(@NullableDecl Object key) {
    if (actualAsNavigableMap().isEmpty()) {
      failWithActual("expected to have first key", key);
      return;
    }

    if (!Objects.equal(actualAsNavigableMap().firstKey(), key)) {
      if (actualAsNavigableMap().containsKey(key)) {
        failWithoutActual(
            simpleFact(
                lenientFormat(
                    "Not true that %s has first key <%s>. "
                        + "It does contain this key, but the first key is <%s>",
                    actualAsString(), key, actualAsNavigableMap().firstKey())));
        return;
      }
      failWithoutActual(
          simpleFact(
              lenientFormat(
                  "Not true that %s has first key <%s>. "
                      + "It does not contain this key, and the first key is <%s>",
                  actualAsString(), key, actualAsNavigableMap().firstKey())));
    }
  }
1221436
def subseq(start_offset=0, end_offset=None):
    
    def _(sequence):
        return sequence.subseq(start_offset, end_offset)
    return _
387776
private boolean containsSeq(String seq) {
        int state = 0;
        for (int i = 0; i < seq.length(); i++) {
            state = next(state, seq.charAt(i));

            if (state == -1)
                return false;
        }

        return d_finalStates.get(state);
    }