Exemple #1
0
    def get (self,project_name):
        project = Project.get_by_key_name('name='+project_name)
        source_files = SourceFile.all().filter('project =',project)

        path = [project_name]

        f = SolutionRenderer()
        templates = process_template_imems()
        process_template_path(templates, path)

        templates.update({
                'files': source_files,
                'projects': projects,
                'path': path,
                'project': project_name
            })
        return self.response.write(f.render('project',templates))
Exemple #2
0
    def get(self,project_name):
        print repr(project_name)

        project = Project.get_by_key_name('name='+project_name)

        source_files = SourceFile.all().filter('project =',project)
        for file in source_files:
            print file
        # print "source_files",source_files

        files = map(lambda x: {'name':x.name,'size':int(x.p*100)}, source_files)
        # print 'files',files

        files = make_nodes_hier(files, project_name)
        result = json.dumps(files)
        print "result",result
        # print 'node_arch',files
        self.response.headers['Content-Type'.encode()] = 'application/json'.encode()
        self.response.out.write(result)
Exemple #3
0
 def init_sources_for_extrapolation(self):
     sources = SourceFile.all()
     tab = []
     tab_x = []
     tab_f = []
     for source in sources:
         if source.vulnerability is not None and \
             source.potential is not None and \
             source.p is not None:
             if int(source.vulnerability.vulnerability) >0 :
                 tab.append((source.potential,source.p))
     tab = list(frozenset(tab))
     tab.sort()
     try:                    
         for i, item in enumerate(tab):
             if tab[i+1] == tab[i]:
                 tab.pop(i)
     except IndexError:
         pass
     print tab
     self.tab_x = map(lambda x: x[0], tab)
     self.tab_f = map(lambda x: x[1], tab)
Exemple #4
0
 def init_sources_for_extrapolation(self):
     sources = SourceFile.all()
     tab = []
     tab_x = []
     tab_f = []
     for source in sources:
         if source.vulnerability is not None and \
             source.potential is not None and \
             source.p is not None:
             if int(source.vulnerability.vulnerability) > 0:
                 tab.append((source.potential, source.p))
     tab = list(frozenset(tab))
     tab.sort()
     try:
         for i, item in enumerate(tab):
             if tab[i + 1] == tab[i]:
                 tab.pop(i)
     except IndexError:
         pass
     print tab
     self.tab_x = map(lambda x: x[0], tab)
     self.tab_f = map(lambda x: x[1], tab)
Exemple #5
0
 def get (self,filehash):
     source_file = SourceFile.all().filter('short',filehash)[0]
     source_file.p = 1.0
     source_file.put()
     recalc_p(source_file)
Exemple #6
0
 def get(self, filehash):
     print filehash
     code = SourceFile.all().filter('short',filehash)[0]
     #print code.source
     self.response.write(code.source)
     return