Define the process auto sort key from the alert type.
557670
def set_process_sort(self, event_type):
        """"""
        if glances_processes.auto_sort:
            glances_processes.sort_key = self.get_event_sort_key(event_type)
1334545
def windows_process_priority_format(instance):
    
    class_suffix_re = re.compile(r'.+_CLASS$')
    for key, obj in instance['objects'].items():
        if 'type' in obj and obj['type'] == 'process':
            try:
                priority = obj['extensions']['windows-process-ext']['priority']
            except KeyError:
                continue
            if not class_suffix_re.match(priority):
                yield JSONError("The 'priority' property of object '%s' should"
                                " end in '_CLASS'." % key, instance['id'],
                                'windows-process-priority-format')
1281041
def process_alert(file_name):
    

    processed_line = open(file_name, 'r').read()
    char_pos = processed_line.find("}")
    new_line = "{" + processed_line[char_pos + 2:]
    return new_line
313388
def sort_ascending(self, key):
        """"""

        row, col, tab = key

        scells = self.grid.code_array[:, col, tab]

        def sorter(i):
            sorted_ele = scells[i]
            return sorted_ele is None, sorted_ele

        sorted_row_idxs = sorted(xrange(len(scells)), key=sorter)

        self.replace_cells(key, sorted_row_idxs)

        self.grid.ForceRefresh()
1097084
def autocmd(name, pattern='*', sync=False, allow_nested=False, eval=None):
    """"""
    def dec(f):
        f._nvim_rpc_method_name = 'autocmd:{}:{}'.format(name, pattern)
        f._nvim_rpc_sync = sync
        f._nvim_bind = True
        f._nvim_prefix_plugin_path = True

        opts = {
            'pattern': pattern
        }

        if eval:
            opts['eval'] = eval

        if not sync and allow_nested:
            rpc_sync = "urgent"
        else:
            rpc_sync = sync

        f._nvim_rpc_spec = {
            'type': 'autocmd',
            'name': name,
            'sync': rpc_sync,
            'opts': opts
        }
        return f
    return dec
855205
def postprocess_keyevent(self, event):
        """"""
        ShellBaseWidget.postprocess_keyevent(self, event)
        if QToolTip.isVisible():
            _event, _text, key, _ctrl, _shift = restore_keyevent(event)
            self.hide_tooltip_if_necessary(key)
64751
function(sort, antiStabilize) {
    return function(a, b) {
      var unstableResult = sort(a.td, b.td);

      if (unstableResult === 0) {
        if (antiStabilize) return b.index - a.index;
        return a.index - b.index;
      }

      return unstableResult;
    };
  }
896273
function keyCompare(arr) {
  if (!_.isArray(arr)) {
    throw new Error("Failed will processing expect array: " + util.inspect(arr))
  }

  var keyArr = []

  // keeps track of the various types of mixed objects.
  var typeLists = {}

  arr.forEach(function(elmnt) {
    // want to collect types and put certains types first.
    var typeName = getConstructorName(elmnt)
    if (!typeLists[typeName]) {
      typeLists[typeName] = []
    }
    if (_.isArray(elmnt)) {
      typeLists[typeName].push(keyCompare(elmnt))
    } else if (_.isObject(elmnt)) {
      // ensure obj is sorted underneath.
      var obj = deepInspect(elmnt)

      // populate set of keys by which to sort in the near future.
      // TODO: figure out how not to prune 'undefined'?
      var modObj = {}
      Object.keys(obj).forEach(function(key) {
        keyArr.push(key)
        modObj[key] = JSON.stringify(obj[key])
      })
      typeLists[typeName].push(modObj)
    } else {
      typeLists[typeName].push(elmnt)
    }
  })

  // Sorts parents based on children by looking the the string representation
  // of the children nodes.
  if (!_.isEmpty(keyArr)) {
    keyArr = _.unique(keyArr)
    sorty(createSortyOpts(keyArr.sort()), typeLists["Object"])

    // Need to undo stringify
    typeLists["Object"].forEach(function(elmnt) {
      Object.keys(elmnt).forEach(function(key) {
        elmnt[key] = JSON.parse(elmnt[key])
      })
    })
  }

  // Put it all back together.
  var resultList = []
  Object.keys(typeLists)
    .sort()
    .forEach(function(key) {
      var result = array_sort(typeLists[key])
      resultList = resultList.concat(result)
    })
  return resultList
}
726727
function _processKey(event, bindings) {
			for (var id in bindings) {
				if (bindings[id] && bindings[id].keyBinding && bindings[id].command) {
					if (bindings[id].keyBinding.match(event)) {
						var activeBinding = bindings[id];
						var keyBinding = activeBinding.keyBinding;
						// Check for keys that are scoped to a particular part of the DOM
						if (!keyBinding.domScope || lib.contains(lib.node(keyBinding.domScope), event.target)) {
							if (executeBinding(activeBinding)) {
								lib.stop(event);
								return;
							}
						}
					}
				}
			}
		}
382662
def set_sort_cb(self, w, index):
        """"""
        name = self.sort_options[index]
        self.t_.set(sort_order=name)
1024604
public static function assocSort(&$arr, $key, $type = SORT_STRING)
    {
        
        $ret = usort($arr, function ($a, $b) use ($key, $type)
        {
            switch ($type) {
                case SORT_STRING:
                    return strcasecmp($a[$key], $b[$key]);
                    break;
                
                case SORT_NUMERIC:
                    return $a[$key] > $b[$key];
                    break;
                
                default:
                    return 0;
            }
        });
        
        return $ret;
    }
1270776
function sortObject(originalSrc, options, done) {
  var callback

  if (options === undefined) {
    // do nothing
  } else if (typeof options === "function") {
    callback = options
  } else {
    callback = done
  }

  if (callback) {
    process.nextTick(function() {
      done(work(originalSrc))
    })
    return
  }

  function work(obj) {
    try {
      // Uses module to sort all objects key names based on standard
      // string ordering.
      var deepSorted = deep_sort_object(obj)

      // Once object keys are sorted, we still need to check for arrays.
      var out = deepInspect(deepSorted)
      return out
    } catch (e) {
      console.log(e)
      throw e
    }
  }

  return work(originalSrc)
}
474634
function handleHeadingKeydown(e) {
    eventUtils.handleLeftRightArrowsKeydown(e, () => {
        e.preventDefault();
        let index = getElementIndex(getHeadingEl(e, this.state.fake));
        const maxIndex = this.headingsEl.children.length - 1;
        const keyCode = e.charCode || e.keyCode;
        if (keyCode === 37) index = index === 0 ? maxIndex : index - 1;
        if (keyCode === 39) index = index === maxIndex ? 0 : index + 1;

        this.headingsEl.children[index].focus();
        if (this.state.activation === 'auto') this.processStateChange(index);
    });
    eventUtils.handleActionKeydown(e, () => {
        e.preventDefault();
        this.handleHeadingClick(e);
    });
}
143085
function(e, ui) {
      var logEntry = {
        ID: $scope.sortingLog.length + 1,
        Text: 'Moved element: ' + ui.item.scope().item.text
      };
      $scope.sortingLog.push(logEntry);
    }
411033
def _sort_handlers(cls, signals, handlers, configs):
        
        def macro_precedence_sorter(flags, hname):
            """The default is to sort 'bottom_up', with lower level getting
            executed first, but sometimes you need them reversed."""
            data = configs[hname]
            topdown_sort = SignalOptions.SORT_TOPDOWN in flags
            if topdown_sort:
                level = levels_count - 1 - data['level']
            else:
                level = data['level']
            if 'begin' in data:
                return (-1, level, hname)
            elif 'end' in data:
                return (1, level, hname)
            else:
                return (0, level, hname)

        levels_count = len(handlers.maps)
        per_signal = defaultdict(list)
        for level, m in enumerate(reversed(handlers.maps)):
            for hname, sig_name in m.items():
                sig_handlers = per_signal[sig_name]
                if hname not in sig_handlers:
                    configs[hname]['level'] = level
                    sig_handlers.append(hname)
        for sig_name, sig_handlers in per_signal.items():
            if sig_name in signals:  # it may be on a mixin
                flags = signals[sig_name].flags
                sig_handlers.sort(key=partial(macro_precedence_sorter,
                                              flags))
        return per_signal
310488
def set_sorting(self, flag):
        """"""
        self.sorting['status'] = flag
        self.header().setSectionsClickable(flag == ON)
824158
function processSort(feed,sort,sortName) {
	if (warnReleaseStatus(sort.release_status)) {
		console.log('Warning: sort '+sortName+' is '+sort.release_status+deprecationInfo(feed,sort.name,'sort',sort.deprecated_since));
	}
	swagSort(sort);
	if (sort.sort_direction) {
		sort.sort_direction = toArray(sort.sort_direction);
		for (var i in sort.sort_direction) {
			var sortDirection = sort.sort_direction[i];
			var sortDirectionName = ('s-'+feed.name+'-'+sort.name+'-'+sortDirection.value).toCamelCase();
			if (seen.indexOf(sortDirectionName)<0) {
				processSortDirection(feed,sort,sortDirection,sortDirectionName);
				seen.push(sortDirectionName);
			}
			else {
				console.log('* Skipping sort '+sortDirectionName+' as duplicate name');
			}
		}
	}
	else {
		if (seen.indexOf(sortName)<0) {
			exportSort(feed,sort,sortName);
			seen.push(sortName);
		}
		else {
			console.log('* Skipping sort '+sortName+' as duplicate name');
		}
	}
}