Sorts source files ahead of parity files.
512382
void sortLostFiles(List<String> files) {
    // TODO: We should first fix the files that lose more blocks
    Comparator<String> comp = new Comparator<String>() {
      public int compare(String p1, String p2) {
        Codec c1 = null;
        Codec c2 = null;
        for (Codec codec : Codec.getCodecs()) {
          if (isParityFile(p1, codec)) {
            c1 = codec;
          } else if (isParityFile(p2, codec)) {
            c2 = codec;
          }
        }
        if (c1 == null && c2 == null) {
          return 0; // both are source files
        }
        if (c1 == null && c2 != null) {
          return -1; // only p1 is a source file
        }
        if (c2 == null && c1 != null) {
          return 1; // only p2 is a source file
        }
        return c2.priority - c1.priority; // descending order
      }
    };
    Collections.sort(files, comp);
  }
160629
def makecsvdiffs(thediffs, dtls, n1, n2):
    """"""
    def ishere(val):
        if val == None:
            return "not here"
        else:
            return "is here"
    rows = []
    rows.append(['file1 = %s' % (n1, )])
    rows.append(['file2 = %s' % (n2, )])
    rows.append('')
    rows.append(theheader(n1, n2))
    keys = list(thediffs.keys()) # ensures sorting by Name
    keys.sort()
    # sort the keys in the same order as in the idd
    dtlssorter = DtlsSorter(dtls)
    keys = sorted(keys, key=dtlssorter.getkey)
    for key in keys:
        if len(key) == 2:
            rw2 = [''] + [ishere(i) for i in thediffs[key]]
        else:
            rw2 = list(thediffs[key])
        rw1 = list(key)
        rows.append(rw1 + rw2)
    return rows
548654
def source_files(self):
        """"""
        if 'srcs' in self.params and self.params['srcs'] is not None:
            return util.flatten(self.params['srcs'])
741724
def sort_loading_order(step_files):
    
    tools = []
    workflows = []
    workflows_with_subworkflows = []

    for f in step_files:
        # assume that urls are tools
        if f.startswith('http://') or f.startswith('https://'):
            tools.append(f)
        else:
            obj = load_yaml(f)
            if obj.get('class', '') == 'Workflow':
                if 'requirements' in obj.keys():
                    subw = {'class': 'SubworkflowFeatureRequirement'}
                    if subw in obj['requirements']:
                        workflows_with_subworkflows.append(f)
                    else:
                        workflows.append(f)
                else:
                    workflows.append(f)
            else:
                tools.append(f)
    return tools + workflows + workflows_with_subworkflows
925499
def check_input_files_for_numbered_seq(sourceDir, suffix, containers):
    """"""
    # Check input files for each MPL-container type.
    for container in containers:
        files = glob.glob( os.path.join( sourceDir, container, container + '*' + suffix ) )
        for currentFile in sorted( files ):
            if check_header_comment( currentFile ):
                return True
    return False
345336
protected void filterMarginalSeparators()
    {
        for (Iterator<Separator> it = hsep.iterator(); it.hasNext();)
        {
            Separator sep = it.next();
            if (sep.getY1() == root.getY1() || sep.getY2() == root.getY2())
                it.remove();
        }
        for (Iterator<Separator> it = vsep.iterator(); it.hasNext();)
        {
            Separator sep = it.next();
            if (sep.getX1() == root.getX1() || sep.getX2() == root.getX2())
                it.remove();
        }
    }
694137
function fileSort(a, b) {
  return Number(b.stat && b.stat.isDirectory()) - Number(a.stat && a.stat.isDirectory()) ||
    String(a.name).toLocaleLowerCase().localeCompare(String(b.name).toLocaleLowerCase());
}
443034
def SortBy(*qs):
    """"""

    sort = []
    for q in qs:
        if q._path.endswith('.desc'):
            sort.append((q._path[:-5], DESCENDING))
        else:
            sort.append((q._path, ASCENDING))
    return sort
246933
public static void sortFile(List<File> jarsList, final String fName) {
        Collections.sort(jarsList, new Comparator<File>() {
            @Override
            public int compare(File f1, File f2) {
                String f1Name = f1.getName();
                f1Name = f1Name.substring(fName.length() + 1, f1Name.length() - 4);
                String f2Name = f2.getName();
                f2Name = f2Name.substring(fName.length() + 1, f2Name.length() - 4);
                Version v1 = Version.createVersion(f1Name);
                Version v2 = Version.createVersion(f2Name);
                if (v1 != null && v2 != null)
                    return v1.compareTo(v2);
                return f1Name.compareTo(f2Name);
            }
        });
    }
68352
private void sortFileList() {
    if (this.size() > 1) {
      Collections.sort(this.fileList, new Comparator() {

        public final int compare(final Object o1, final Object o2) {
          final File f1 = (File) o1;
          final File f2 = (File) o2;
          final Object[] f1TimeAndCount = backupSuffixHelper
              .backupTimeAndCount(f1.getName(), baseFile);
          final Object[] f2TimeAndCount = backupSuffixHelper
              .backupTimeAndCount(f2.getName(), baseFile);
          final long f1TimeSuffix = ((Long) f1TimeAndCount[0]).longValue();
          final long f2TimeSuffix = ((Long) f2TimeAndCount[0]).longValue();
          if ((0L == f1TimeSuffix) && (0L == f2TimeSuffix)) {
            final long f1Time = f1.lastModified();
            final long f2Time = f2.lastModified();
            if (f1Time < f2Time) {
              return -1;
            }
            if (f1Time > f2Time) {
              return 1;
            }
            return 0;
          }
          if (f1TimeSuffix < f2TimeSuffix) {
            return -1;
          }
          if (f1TimeSuffix > f2TimeSuffix) {
            return 1;
          }
          final int f1Count = ((Integer) f1TimeAndCount[1]).intValue();
          final int f2Count = ((Integer) f2TimeAndCount[1]).intValue();
          if (f1Count < f2Count) {
            return -1;
          }
          if (f1Count > f2Count) {
            return 1;
          }
          if (f1Count == f2Count) {
            if (fileHelper.isCompressed(f1)) {
              return -1;
            }
            if (fileHelper.isCompressed(f2)) {
              return 1;
            }
          }
          return 0;
        }
      });
    }
  }
213546
protected void sortPreparePriorityResources() {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "sortPreparePriorityResources", _resourceObjects.toArray());

        Collections.sort(_resourceObjects, prepareComparator);

        if (tc.isEntryEnabled())
            Tr.exit(tc, "sortPreparePriorityResources", _resourceObjects.toArray());
        return;
    }
1286280
def sorted(cls, items, orders):
    ''''''
    return sorted(items, cmp=cls.multipleOrderComparison(orders))
317367
def queue_files(dirpath, queue):
    """"""
    for root, _, files in os.walk(os.path.abspath(dirpath)):
        if not files:
            continue
        for filename in files:
            queue.put(os.path.join(root, filename))
565252
def sortedSemver(versions, sort="asc"):
    """"""
    if versions and isinstance(versions, (list, tuple)):
        if PY2:
            return sorted(versions, cmp=semver.compare, reverse=True if sort.upper() == "DESC" else False)
        else:
            from functools import cmp_to_key
            return sorted(versions, key=cmp_to_key(semver.compare), reverse=True if sort.upper() == "DESC" else False)
    else:
        raise TypeError("Invaild Versions, a list or tuple is right.")
1126590
def process_files
      if @options[:parallel].empty?
        files.map { |path| check_path(path) }
      else
        Parallel.map(files, @options[:parallel]) { |path| check_path(path) }
      end
    end
1239028
def source_files
      return @source_files if @source_files

      old_dir = Dir.pwd
      Dir.chdir @rakefile_path
      @source_files = Rake::Path.find_files(@source_search_paths, source_file_extension).uniq.sort
      Dir.chdir old_dir
      @source_files
    end
307273
static private void checkDuplication(FileSystem fs, Path file, Path sorted,
    Configuration conf) throws IOException {
    SequenceFile.Reader in = null;
    try {
      SequenceFile.Sorter sorter = new SequenceFile.Sorter(fs,
        new Text.Comparator(), Text.class, Text.class, conf);
      sorter.sort(file, sorted);
      in = new SequenceFile.Reader(fs, sorted, conf);

      Text prevdst = null, curdst = new Text();
      Text prevsrc = null, cursrc = new Text(); 
      for(; in.next(curdst, cursrc); ) {
        if (prevdst != null && curdst.equals(prevdst)) {
          throw new DuplicationException(
            "Invalid input, there are duplicated files in the sources: "
            + prevsrc + ", " + cursrc);
        }
        prevdst = curdst;
        curdst = new Text();
        prevsrc = cursrc;
        cursrc = new Text();
      }
    }
    finally {
      checkAndClose(in);
    }
  }