当前位置: 首页>>代码示例>>Python>>正文


Python Detector.run方法代码示例

本文整理汇总了Python中detector.Detector.run方法的典型用法代码示例。如果您正苦于以下问题:Python Detector.run方法的具体用法?Python Detector.run怎么用?Python Detector.run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在detector.Detector的用法示例。


在下文中一共展示了Detector.run方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from detector import Detector [as 别名]
# 或者: from detector.Detector import run [as 别名]
 def run(self):
     '''Reads assignments from Assignment_* folders, student numbers from
        their Assignment_x folder, generates a zip of each students' code
        files and runs the Detector on it'''
     assignment_id_map = {}
     assignments = self.get_folder_names(self.path)
     database = DatabaseManager()
     for assignment in assignments:
         document_assignment_number = self.get_assignment_number(assignment)
         if document_assignment_number not in  (6, 5):
             continue
         if document_assignment_number not in assignment_id_map:
             name = 'Assignment %d' % document_assignment_number
             assignment_id_map[document_assignment_number] = database.store_assignment(name, name, '2015-01-01')
         assignment_number = assignment_id_map[document_assignment_number]
         assignment_path = os.path.join(self.path, assignment)
         student_numbers = self.get_folder_names(assignment_path)
         for student_number in student_numbers:
             student_folder = os.path.join(assignment_path, student_number)
             output_file = StringIO()
             zip = zipfile.ZipFile(output_file, 'w')
             for file in self.get_file_names(student_folder):
                 zip.write(os.path.join(student_folder, file), file)
                 print('zipping: ' + file)
             zip.close()
             detector = Detector()
             detector.run(output_file, assignment_number,student_number)
开发者ID:MrHamdulay,项目名称:csc3-capstone,代码行数:29,代码来源:dataGenerator.py


注:本文中的detector.Detector.run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。