def loads(self): ''' loads a raw file of bug report :return: ''' fileConnt = self.getFileCounts(self.SourceBugPath) bugitems = [] # show progress progress = Progress(u'[%s] Loading bug reports' % self.__name__, 2, 10, True) progress.set_upperbound(fileConnt) progress.start() for root, dirs, files in os.walk(self.SourceBugPath): for f in files: if f[:f.find(u'-')].strip().lower() != self.ProjectName.lower( ): continue #shutil.copy(os.path.join(root, f), os.path.join(_dest, f)) bugitem = self.get_bugitem(os.path.join(root, f)) if bugitem is not None: bugitems.append(bugitem) progress.check() progress.done() return bugitems
def source_counting(self, _group, _project): statistics = {} progress = Progress('source counting', 2, 10, True) progress.set_upperbound(len(self.S.versions[_project].keys())) progress.start() for version in self.S.versions[_project].keys(): vname = VersionUtil.get_versionName(version, _project) repo = os.path.join(self.S.getPath_source(_group, _project, vname), ) result = self.getCodeCount(repo) if result is None: continue statistics[vname] = result progress.check() progress.done() maxValue = 0 for vname in statistics: if maxValue < statistics[vname]: maxValue = statistics[vname] statistics['max'] = maxValue pretty = PrettyStringBuilder(_indent_depth=2) text = pretty.get_dicttext({_project: statistics}) f = open( os.path.join(self.S.getPath_base(_group, _project), u'sources.txt'), 'w') f.write(text) f.close()