当前位置: 首页>>代码示例>>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;未经允许,请勿转载。