當前位置: 首頁>>代碼示例>>Python>>正文


Python Criteria.process_criteria方法代碼示例

本文整理匯總了Python中criteria.helper.criteria.Criteria.process_criteria方法的典型用法代碼示例。如果您正苦於以下問題:Python Criteria.process_criteria方法的具體用法?Python Criteria.process_criteria怎麽用?Python Criteria.process_criteria使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在criteria.helper.criteria.Criteria的用法示例。


在下文中一共展示了Criteria.process_criteria方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: process_criterias

# 需要導入模塊: from criteria.helper.criteria import Criteria [as 別名]
# 或者: from criteria.helper.criteria.Criteria import process_criteria [as 別名]
    def process_criterias(cls, feature, criteria=None, config=None, show=False, test=False):
        '''function to delegate the call to the right criteria class and build the criteria for that class
        '''
        from criteria.helper.criteria import Criteria
        from criteria.helper.gene_criteria import GeneCriteria
        from criteria.helper.marker_criteria import MarkerCriteria
        from criteria.helper.region_criteria import RegionCriteria
        from criteria.helper.study_criteria import StudyCriteria

        if config is None:
            if test:
                config = cls.get_criteria_config(ini_file='test_criteria.ini')
            else:
                config = cls.get_criteria_config(ini_file='criteria.ini')

        available_criterias = Criteria.get_available_criterias(feature, config=config, test=test)[feature]

        criterias_to_process = []
        if criteria is None:
            criterias_to_process = available_criterias
        else:
            criterias_list = criteria.split(',')
            criterias_to_process = [criteria.strip() for criteria in criterias_list
                                    if criteria.strip() in available_criterias]

        if show:
            print(criterias_to_process)
            return criterias_to_process

        logger.debug(datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S'))
        for section in criterias_to_process:
            if feature == 'gene':
                print('Call to build criteria gene index')
                Criteria.process_criteria(feature, section, config, GeneCriteria, test=test)
            elif feature == 'marker':
                print('Call to build criteria marker index')
                Criteria.process_criteria(feature, section, config, MarkerCriteria, test=test)
            elif feature == 'region':
                print('Call to build criteria region index')
                Criteria.process_criteria(feature, section, config, RegionCriteria, test=test)
            elif feature == 'study':
                print('Call to build criteria study index')
                Criteria.process_criteria(feature, section, config, StudyCriteria, test=test)
            else:
                logger.critical('Unsupported feature ... please check the inputs')

        logger.debug(datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S'))
        logger.debug('========DONE==========')
開發者ID:D-I-L,項目名稱:django-criteria,代碼行數:50,代碼來源:criteria_manager.py


注:本文中的criteria.helper.criteria.Criteria.process_criteria方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。