Recursively sorts all elements in a dictionary

    Args:
        data (dict): The dictionary to sort

    Returns:
        sorted_dict (OrderedDict): The sorted data dict
169186
def sort_recursive(data):
    

    newdict = {}

    for i in data.items():
        if type(i[1]) is dict:
            newdict[i[0]] = sort_recursive(i[1])
        else:
            newdict[i[0]] = i[1]

    return OrderedDict(sorted(newdict.items(), key=lambda item: (compare_type(type(item[1])), item[0])))
266428
def _pure_data(self, data: Any) -> Any:
        
        if not isinstance(data, dict) and not isinstance(data, list):
            try:
                return dict(data)
            except TypeError:
                ...
        return data
448428
def ordered(obj):
    
    if isinstance(obj, collections.abc.Mapping):
        return sorted((k, ordered(v)) for k, v in obj.items())
    # Special case str since it's a collections.abc.Iterable
    elif isinstance(obj, str):
        return obj
    elif isinstance(obj, collections.abc.Iterable):
        return sorted(ordered(x) for x in obj)
    else:
        return obj
887764
def handle(self, data):
        
        self.logger.debug("Handling " + str(len(data)) + " data items")
        for datum in data:
            if isinstance(datum, dict):
                # these have to wrapped in a list for python 3.4 due to a change in the implementation
                # of OrderedDict in python 3.5+ (which means .keys() and .values() are sequences in 3.5+)
                if self._first:
                    self._csv.writerow(list(datum.keys()))
                    self._first = False
                self._csv.writerow(list(datum.values()))
            elif isinstance(datum, list):
                self._csv.writerow(datum)
            else:
                self.logger.warning("Ignoring unsupported data type " + str(type(datum)) + " : " + str(datum))
227997
def as_sorted_list(options):
        
        if len(options) > 0:
            options = sorted(options, key=lambda o: o.number)
        return options
1009878
def deserialize(self, data):
        
        if not data:
            return dict()
        return self._deserialize_datetime(pickle.loads(data))
1241401
def check_data(self, data):
        
        data_objs = {
            data_src: data.objects.get(data_src) for data_src in data.layer
        }
        self._is_data_loaded = all(data_objs.values())
        return data_objs
213400
public <T extends Comparable<? super T>> List<T> sort (Collection<T> data)
    {
        return sort(new ArrayList<T>(data));
    }
605609
def _dict_to_name_value(data):
    '''
    
    '''
    if isinstance(data, dict):
        sorted_data = sorted(data.items(), key=lambda s: s[0])
        result = []
        for name, value in sorted_data:
            if isinstance(value, dict):
                result.append({name: _dict_to_name_value(value)})
            else:
                result.append({name: value})
    else:
        result = data
    return result
21719
def all(self, data={}, **kwargs):
        "
        return super(Order, self).all(data, **kwargs)
935324
def sift(data, required_items=None):
    
    required_items = required_items or []
    new_data = {}
    for k, v in data.items():
        if v[0] in required_items:
            new_data[k] = v
            continue
        for required_item in required_items:
            key = getattr(required_item, '_object', False)
            if key:
                if v[0] == key:
                    new_data[k] = v

    return re_sort(new_data)
1221143
def sorted(self, key=None, reverse=False):
        
        return self._transform(transformations.sorted_t(key=key, reverse=reverse))
727031
def __respond_with_dict(self, data):
        
        response = {}
        if isinstance(data, list):
            temp_data, data = data, {}
            for key, value in enumerate(temp_data):
                data[key] = value

        data.pop('seq', None)
        for index, item in data.items():
            values = item
            if isinstance(item, list) or isinstance(item, dict):
                values = self.__respond_with_dict(item)

            if isinstance(values, dict) and len(values) == 1:
                (key, values), = values.items()
            response[index] = values

        return response
156829
def sort_by(self, property, order="asc"):
        
        self.__prepare()
        if isinstance(self._json_data, list):
            if order == "asc":
                self._json_data = sorted(
                    self._json_data,
                    key=lambda x: x.get(property)
                )
            else:
                self._json_data = sorted(
                    self._json_data,
                    key=lambda x: x.get(property),
                    reverse=True
                )

        return self
500206
function sortedKeys(dictionary) {
  let keys = [];
  for (let key in dictionary) {
    keys.push(key);
  }
  return keys.sort();
}
608950
def _remove_none(data):
    
    if isinstance(data, list) or isinstance(data, tuple):
        return [x for x in data if x is not None]

    out = OrderedDict()
    for key, val in data.iteritems():
        if val is not None:
            out[key] = val

    return out
782178
def sorted_t(key=None, reverse=False):
    
    return Transformation(
        'sorted',
        lambda sequence: sorted(sequence, key=key, reverse=reverse),
        None
    )