Sort by commit size, per author.
193923
def sort(self):
        """"""
        # First sort commits by author email
        users = []
        # Group commits by author email, so they can be merged
        for _, group in itertools.groupby(sorted(self.commits),
                                          operator.attrgetter('author_mail')):
            if group:
                users.append(self.merge_user_commits(group))
        # Finally sort by the (aggregated) commits' line counts
        self.sorted_commits = sorted(users,
                                     key=operator.attrgetter('line_count'),
                                     reverse=True)
        return self.sorted_commits
1042153
def sort(self):
        """"""
        self.sorted_commits = sorted(self.commits,
                                     key=lambda x: x.committer_time,
                                     reverse=True)
        return self.sorted_commits
1292358
def nonfirst_authors(self, key, value):
    
    field_700 = self.get('700__', [])
    field_701 = self.get('701__', [])

    is_supervisor = any(el.lower().startswith('dir') for el in force_list(value.get('e', '')))
    if is_supervisor:
        field_701.append(_converted_author(value))
    else:
        field_700.append(_converted_author(value))

    self['701__'] = field_701
    return field_700
180469
def _prepare_commit_msg(tmp_file, author, files_modified=None, template=None):
    
    files_modified = files_modified or []
    template = template or "{component}:\n\nSigned-off-by: {author}\n{extra}"
    if hasattr(template, "decode"):
        template = template.decode()

    with open(tmp_file, "r", "utf-8") as fh:
        contents = fh.readlines()
        msg = filter(lambda x: not (x.startswith("#") or x.isspace()),
                     contents)
        if len(list(msg)):
            return

    component = "unknown"
    components = _get_components(files_modified)

    if len(components) == 1:
        component = components[0]
    elif len(components) > 1:
        component = "/".join(components)
        contents.append(
            "# WARNING: Multiple components detected - consider splitting "
            "commit.\r\n"
        )

    with open(tmp_file, "w", "utf-8") as fh:
        fh.write(template.format(component=component,
                                 author=author,
                                 extra="".join(contents)))
286141
def itemsize_bits(self):
        """"""
        if self.dtype is not None:
            return self.dtype.itemsize * 8
        else:
            return sum(x[1] for x in self.format)
449121
function getIndexSizes(done, results) {
  var client = results.client;
  var ns = mongodbNS(results.namespace);
  client
    .db(ns.database)
    .collection(ns.collection)
    .stats(function(err, res) {
      if (err) {
        if (isNotAuthorizedError(err)) {
          debug(
            'Not authorized to get collection stats.  Returning default for indexSizes {}.'
          );
          return done(null, {});
        }
        return done(err);
      }

      res = _.mapValues(res.indexSizes, function(size) {
        return { size: size };
      });
      done(null, res);
    });
}
1245550
def all_prev_ordered(self, commit: Commit):
        
        # TODO: This method does a lot of work, choose correct data
        # structures to make it efficient.

        viewNo, ppSeqNo = commit.viewNo, commit.ppSeqNo

        if self.last_ordered_3pc == (viewNo, ppSeqNo - 1):
            # Last ordered was in same view as this COMMIT
            return True

        # if some PREPAREs/COMMITs were completely missed in the same view
        toCheck = set()
        toCheck.update(set(self.sentPrePrepares.keys()))
        toCheck.update(set(self.prePrepares.keys()))
        toCheck.update(set(self.prepares.keys()))
        toCheck.update(set(self.commits.keys()))
        for (v, p) in toCheck:
            if v < viewNo and (v, p) not in self.ordered:
                # Have commits from previous view that are unordered.
                return False
            if v == viewNo and p < ppSeqNo and (v, p) not in self.ordered:
                # If unordered commits are found with lower ppSeqNo then this
                # cannot be ordered.
                return False

        return True
1027242
def _publish_metrics(self, name, prev_keys, key, data):
        """"""
        value = data[key]
        keys = prev_keys + [key]
        if isinstance(value, dict):
            for new_key in value:
                self._publish_metrics(name, keys, new_key, value)
        elif isinstance(value, (float, int, long)):
            joined_keys = '.'.join(keys)
            if name:
                publish_key = '{}.{}'.format(name, joined_keys)
            else:
                publish_key = joined_keys
            if isinstance(value, bool):
                value = int(value)

            self.publish(publish_key, value)
47178
def sort_by_efficiency(self, reverse=True):
        """"""
        self._confs.sort(key=lambda c: c.efficiency, reverse=reverse)
        return self
218718
def _sortByModified(a, b):
    """"""
    if a.modified < b.modified:
        return 1
    elif a.modified > b.modified:
        return -1
    else:
        return 0
136740
def list_authors():
    """"""
    authors = Author.query.all()
    content = '<p>Authors:</p>'
    for author in authors:
        content += '<p>%s</p>' % author.name
    return content
197765
def rank(self):
        """"""
        r = np.empty(self.size, np.int)
        r[self.sorter] = np.arange(self.size)
        return r
632194
def add_commit(self, commit):
        
        sha1 = commit.hex
        if sha1 in self._commits:
            return self._commits[sha1]
        title, separator, body = commit.message.partition("\n")
        commit = {
            'explored': False,
            'sha1': sha1,
            'name': GitUtils.abbreviate_sha1(sha1),
            'describe': GitUtils.describe(sha1),
            'refs': GitUtils.refs_to(sha1, self.repo()),
            'author_name': commit.author.name,
            'author_mail': commit.author.email,
            'author_time': commit.author.time,
            'author_offset': commit.author.offset,
            'committer_name': commit.committer.name,
            'committer_mail': commit.committer.email,
            'committer_time': commit.committer.time,
            'committer_offset': commit.committer.offset,
            # 'message': commit.message,
            'title': title,
            'separator': separator,
            'body': body.lstrip("\n"),
        }
        self._json['commits'].append(commit)
        self._commits[sha1] = len(self._json['commits']) - 1
        return self._commits[sha1]
797999
function sortFontSizes(fontSizes) {
        var r = {};
        var temp = [];
        var size = 0;
        var biggest = 0;

        for (var prop in fontSizes) {
            if (fontSizes.hasOwnProperty(prop)) {

                size++;

                var val = prop.replace(/[^0-9.\/]/g, '').replace(/\/[0-9]/g, '');

                if (prop.indexOf('%') > -1) {
                    val = 16 / 100 * val;
                }

                if (prop.indexOf('em') > -1
                    || prop.indexOf('rem') > -1
                    || prop.indexOf('vw') > -1
                    || prop.indexOf('vh') > -1) {
                    val = 16 * val;
                }

                if (val === '') {
                    val = prop;
                }

                biggest = val > biggest ? val : biggest;

                if (/[0-9.]/g.test(val)) {
                    temp.push({
                                  viewSizePx:  val,
                                  viewSizeStr: '',
                                  cssSize:     prop,
                                  amount:      fontSizes[prop]
                              });
                } else {
                    temp.push({
                                  viewSizePx:  0,
                                  viewSizeStr: val,
                                  cssSize:     prop,
                                  amount:      fontSizes[prop]
                              });
                }


            }
        }


        r = temp.sort(function (a, b) {
            return b.viewSizePx - a.viewSizePx;
        });

        return r;
    }
922253
def get_contributor_sort_value(self, obj):
        """"""
        user = obj.contributor

        if user.first_name or user.last_name:
            contributor = user.get_full_name()
        else:
            contributor = user.username

        return contributor.strip().lower()
1338195
def authors(self, *usernames):
        
        if len(usernames) == 1:
            return self.filter(**{"author__{}".format(User.USERNAME_FIELD): usernames[0]})
        else:
            return self.filter(**{"author__{}__in".format(User.USERNAME_FIELD): usernames})
555192
public long setCommitIndex(long commitIndex) {
    this.commitIndex = Math.max(this.commitIndex, commitIndex);
    writer.commit(this.commitIndex);
    return this.commitIndex;
  }