Return true if all values in sequence are within n SDs
765607
def within_n_sds(n, series):
    """"""
    z_score = (series - series.mean()) / series.std()
    return (z_score.abs() <= n).all()
615702
def has_next(self):
        """"""
        if self._result_cache:
            return self._result_cache.has_next

        return self.all().has_next
247808
def excluding(self, sequence) -> Generator:
        """"""
        return (element for element in sequence
                if self.indexer(element) not in self.predicates)
558549
private function isAutoIncrementSequenceInSchema($schema, $sequence)
    {
        foreach ($schema->getTables() as $table) {
            if ($sequence->isAutoIncrementsFor($table)) {
                return true;
            }
        }

        return false;
    }
339580
def _has_sorted_sa_indices(s_indices, a_indices):
    
    L = len(s_indices)
    for i in range(L-1):
        if s_indices[i] > s_indices[i+1]:
            return False
        if s_indices[i] == s_indices[i+1]:
            if a_indices[i] >= a_indices[i+1]:
                return False
    return True
1263173
def _check_insersection(self, version, ranges):
        """"""

        for ver_range in ranges:
            if not self._check_ver_range(version, ver_range):
                return False

        return True
856875
def ContainsNone(self, *values):
    
    self._awql = self._CreateMultipleValuesCondition(values, 'CONTAINS_NONE')
    return self._query_builder
1176415
def match_sp_sep(first, second):
    
    if isinstance(first, list):
        one = [set(v.split(" ")) for v in first]
    else:
        one = [{v} for v in first.split(" ")]

    if isinstance(second, list):
        other = [set(v.split(" ")) for v in second]
    else:
        other = [{v} for v in second.split(" ")]

    # all values in one must appear in other
    if any(rt not in other for rt in one):
        return False
    return True
983956
def strip_tail(sequence, values):
    """"""
    return list(reversed(list(strip_head(reversed(sequence), values))))
1104256
def ensure_list(value: Union[T, Sequence[T]]) -> Sequence[T]:
    """"""
    if value is None:
        return []
    return value if isinstance(value, list) else [value]
1242163
def contains(self, x, ctrs, kdtree=None):
        """"""

        return self.overlap(x, ctrs, kdtree=kdtree) > 0
196155
def is_consecutive(bins, rtol: float = 1.e-5, atol: float = 1.e-8) -> bool:
    
    bins = np.asarray(bins)
    if bins.ndim == 1:
        return True
    else:
        bins = make_bin_array(bins)
        return np.allclose(bins[1:, 0], bins[:-1, 1], rtol, atol)
863572
public boolean containsNaN() {
        for (int i = 0; i < values.length; i++) {
            if (s.isNaN(values[i])) {
                return true;
            }
        }
        return false;
    }
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
55405
def find_near_matches_levenshtein(subsequence, sequence, max_l_dist):
    
    if not subsequence:
        raise ValueError('Given subsequence is empty!')
    if max_l_dist < 0:
        raise ValueError('Maximum Levenshtein distance must be >= 0!')

    if max_l_dist == 0:
        return [
            Match(start_index, start_index + len(subsequence), 0)
            for start_index in search_exact(subsequence, sequence)
        ]

    elif len(subsequence) // (max_l_dist + 1) >= 3:
        return find_near_matches_levenshtein_ngrams(subsequence,
                                                    sequence,
                                                    max_l_dist)

    else:
        matches = find_near_matches_levenshtein_linear_programming(subsequence,
                                                                   sequence,
                                                                   max_l_dist)
        match_groups = group_matches(matches)
        best_matches = [get_best_match_in_group(group) for group in match_groups]
        return sorted(best_matches)
640976
def _is_subsequence_of(self, sub, sup):
        
        return bool(re.search(".*".join(sub), sup))
682203
def contains_list(longer, shorter):
    """"""
    if len(longer) <= len(shorter):
        return False
    for a, b in zip(shorter, longer):
        if a != b:
            return False
    return True