Returns a tuple with down/up-cast.
14710
def split(df):
    """"""
    idx = df.index.argmax() + 1
    down = df.iloc[:idx]
    # Reverse index to orient it as a CTD cast.
    up = df.iloc[idx:][::-1]
    return down, up
406217
def maybe_cast_list(value, types):
    
    if not isinstance(value, list):
        return value

    if type(types) not in (list, tuple):
        types = (types,)

    for list_type in types:
        if issubclass(list_type, list):
            try:
                return list_type(value)
            except (TypeError, ValueError):
                pass
    return value
1001812
def xrify_tuples(self, tup):
        """"""
        return xr.DataArray(tup,
                            dims=['bands'],
                            coords={'bands': self.data['bands']})
1138696
def get_version_tuple(string):
    ''''''
    match = re.match(r'(\d+)\.(\d+)\.?(\d*)([abc]?)(\d*)', string)
    major = int(match.group(1))
    minor = int(match.group(2))
    patch = int(match.group(3) or 0)
    level = RELEASE_LEVEL_MAP.get(match.group(4), 'final')
    serial = int(match.group(5) or 0)

    return major, minor, patch, level, serial
970359
def to_sparse_tuple(sequence):
    
    """
    indices = np.asarray(list(zip([0]*len(sequence), range(len(sequence)))), dtype=np.int64)
    shape = np.asarray([1, len(sequence)], dtype=np.int64)
    return indices, sequence, shape
500779
def make_tuple(obj, cast=True):
    
    if isinstance(obj, tuple):
        return tuple(obj)
    elif is_lazy_iterable(obj):
        return tuple(obj)
    elif isinstance(obj, (list, set)) and cast:
        return tuple(obj)
    else:
        return (obj,)
251710
def convert_dict2tuple(value):
    
    if isinstance(value, dict):
        for _keys in value:
            value[_keys] = convert_dict2tuple(value[_keys])
        return tuple(sorted(value.items()))
    else:
        return value
1034814
def all_down(self):
        
        level = self
        while level.down:
            level = level.down
        return level
1243769
function normalizeTolerance (t) {
  return t === Object(t) ? t : { down: t, up: t }
}
556365
def tupletize_version(version_string):
    '''
    
    '''
    return tuple(int(x) for x in re.findall(r'[0-9]+', version_string))
781075
def get_inputs_from_cm(index, cm):
    """"""
    return tuple(i for i in range(cm.shape[0]) if cm[i][index])
526464
def to_tuple(self):
        """"""
        return (
            self.data_type,
            self.unit,
            self.analysis_period,
            self.metadata
        )
814304
def ver_str_to_tuple(ver_str):
    """"""
    out = []
    for x in ver_str.split("."):
        try:
            x = int(x)
        except ValueError:
            pass
        out.append(x)
    return tuple(out)
927947
def _subtotals(self):
        """"""
        return tuple(
            _Subtotal(subtotal_dict, self.valid_elements)
            for subtotal_dict in self._iter_valid_subtotal_dicts()
        )
563208
def values(self):
        ""
        return tuple(set(self.new.values()).union(self.old.values()))
1147745
def sort(self, *sort_tuples):
        ''' 
        '''
        query = self
        for name, direction in sort_tuples:
            field = resolve_name(self.type, name)
            if direction in (ASCENDING, 1):
                query = query.ascending(field)
            elif direction in (DESCENDING, -1):
                query = query.descending(field)
            else:
                raise BadQueryException('Bad sort direction: %s' % direction)
        return query
1319933
def as_tuple(obj):
    "  "

    if not obj:
        return tuple()

    if isinstance(obj, (tuple, set, list)):
        return tuple(obj)

    if hasattr(obj, '__iter__') and not isinstance(obj, dict):
        return obj

    return obj,