Пример #1
0
 def setUp(self):
     super(ProjectTest, self).setUp()
     self.android_project = Project('android_os',
                                    path_regexes=['.*googleplex-android/'],
                                    function_regexes=['android.'])
     self.chromium_project = Project('chromium',
                                     function_regexes=['org.chromium'],
                                     host_directories=['src/'])
 def setUp(self):
   super(ProjectClassifierTest, self).setUp()
   projects = [Project(name, path_regexs, function_regexs, host_directories)
               for name, path_regexs, function_regexs, host_directories
               in PROJECT_CONFIG['project_path_function_hosts']]
   self.classifier = ProjectClassifier(
       projects, PROJECT_CONFIG['top_n'],
       PROJECT_CONFIG['non_chromium_project_rank_priority'])
Пример #3
0
    def __init__(self, get_repository, config):
        """
    Args:
      get_repository (callable): a function from DEP urls to ``Repository``
        objects, so we can get changelogs and blame for each dep. Notably,
        to keep the code here generic, we make no assumptions about
        which subclass of ``Repository`` this function returns. Thus,
        it is up to the caller to decide what class to return and handle
        any other arguments that class may require (e.g., an http client
        for ``GitilesRepository``).
      config (ndb.CrashConfig): Config for clients and project and component
        classifiers.
    """
        self._get_repository = get_repository

        # The top_n is the number of frames we want to check to get project
        # classifications.
        projects = [
            Project(name, path_regexs, function_regexs, host_directories)
            for name, path_regexs, function_regexs, host_directories in
            config.project_classifier['project_path_function_hosts']
        ]
        self._project_classifier = ProjectClassifier(
            projects, config.project_classifier['top_n'],
            config.project_classifier['non_chromium_project_rank_priority'])

        # The top_n is the number of frames we want to check to get component
        # classifications.
        components = [
            Component(info['component'], info['dirs'], info.get('function'),
                      info.get('team'))
            for info in config.component_classifier['component_info']
        ]
        self._component_classifier = ComponentClassifier(
            components, config.component_classifier['top_n'])

        self._config = config