def _next_erepo(self):
        try:
            erepo = ERepo.get(ERepo._elaborated == False)
        except ERepo.DoesNotExist:
            erepo = None

        return erepo
Ejemplo n.º 2
0
"""A script to interactively examine the distribution of repos."""

import cPickle as pickle
import datetime
import numpy as np
import random

from config import feature_pickle_name
from models import ERepo
import utils


cutoff = datetime.datetime.now() - datetime.timedelta(days=6 * 30)

frepos = [r for r in ERepo.select().where(ERepo.created_at < cutoff)]
frepos = [r for r in frepos if
          r.size > 0 and
          r._stars > 2 and
          r.fork == False and
          r.master_branch == 'master' and
          not (r.size > 30720) #and r._stars < 100)  # avoid huge repos, but keep pop
          ]

print 'filtered:', len(frepos)


def divy(ranges):
    res = []
    for l, h in ranges:
        res.append([x for x in frepos if l <= x._stars <= h])
    return res