예제 #1
0
def detail(name):
    try:
        id  = int(name)
    except:
        id  = 0
    table = PluginTable()
    if id > 0:
        plugin = table.findById(id)
    else:
        plugin = table.findByName(name)

    if plugin:
        printPlugin(plugin)
    else:
        print "Sorry, we cannot find plugin %s for you" % name
예제 #2
0
파일: grader.py 프로젝트: reedboat/vimfound
    def calc(self, id=0, data=None):
        table = PluginTable()
        table.connect()
        id = int(id)
        avg = self.calcAvg()

        if id > 0:
            data  = table.findById(id)
        if data:
            score = self.gradePlugin(data, avg)
            table.updateScore(id, score)
            return score

        rows=table.query(None, None, 0)
        for row in rows:
            score = self.gradePlugin(row, avg)
            table.updateScore(row['id'], score)
        return len(rows)
예제 #3
0
def grade(name=None):
    grader = Grader()
    if not name:
        count = grader.calc()
        print "jobs done, scores of %d plugins updated" % count
        return 

    try:
        id = int(name)
    except:
        id = 0

    table = PluginTable()
    if id:
        plugin = table.findById(id)
    else:
        plugin = table.findByName(name)

    if plugin:
        grader.calc(data=plugin)
    else:
        print "Sorry, we cannot find plugin %s" % name