def _crawl_single_feature(feature,
                          feature_options,
                          crawlmode,
                          crawler,
                          emitter):
    if feature == 'os':
        if crawlmode in [Modes.INVM, Modes.OUTCONTAINER, Modes.MOUNTPOINT]:
            for (key, feature) in crawler.crawl_os(**feature_options):
                emitter.emit(key, feature)
    if feature == 'disk':
        if crawlmode in [Modes.INVM, Modes.OUTCONTAINER, Modes.MOUNTPOINT]:
            for (key, feature) in \
                    crawler.crawl_disk_partitions(**feature_options):
                emitter.emit(key, feature)
        else:
            logger.warning('Cannot crawl feature: ' + feature +
                           ' in crawl mode: ' + crawlmode +
                           '. Skipping...')
    if feature == 'metric':
        if crawlmode in [Modes.INVM, Modes.OUTCONTAINER]:
            for (key, feature) in \
                    crawler.crawl_metrics(**feature_options):
                emitter.emit(key, feature)
        else:
            logger.warning('Cannot crawl feature: ' + feature +
                           ' in crawl mode: ' + crawlmode +
                           '. Skipping...')
    if feature == 'process':
        if crawlmode in [Modes.INVM, Modes.OUTVM, Modes.OUTCONTAINER]:
            for (key, feature) in \
                    crawler.crawl_processes(**feature_options):
                emitter.emit(key, feature)
        else:
            logger.warning('Cannot crawl feature: ' + feature +
                           ' in crawl mode: ' + crawlmode +
                           '. Skipping...')
    if feature == 'connection':
        if crawlmode in [Modes.INVM, Modes.OUTVM, Modes.OUTCONTAINER]:
            for (key, feature) in \
                    crawler.crawl_connections(**feature_options):
                emitter.emit(key, feature)
        else:
            logger.warning('Cannot crawl feature: ' + feature +
                           ' in crawl mode: ' + crawlmode +
                           '. Skipping...')
    if feature == 'package':
        if crawlmode in [Modes.INVM, Modes.OUTCONTAINER, Modes.MOUNTPOINT]:
            for (key, feature) in \
                    crawler.crawl_packages(**feature_options):
                emitter.emit(key, feature)
    if feature == 'file':
        if crawlmode in [Modes.INVM, Modes.OUTCONTAINER, Modes.MOUNTPOINT]:
            for (key, feature) in crawler.crawl_files(**feature_options):
                emitter.emit(key, feature)
    if feature == 'config':
        for (key, feature) in \
                crawler.crawl_config_files(**feature_options):
            emitter.emit(key, feature)
    if feature == 'memory':
        if crawlmode in [Modes.INVM, Modes.OUTVM, Modes.OUTCONTAINER]:
            for (key, feature) in crawler.crawl_memory(**feature_options):
                emitter.emit(key, feature)
        else:
            logger.warning('Cannot crawl feature: ' + feature +
                           ' in crawl mode: ' + crawlmode +
                           '. Skipping...')
    if feature == 'cpu':
        if crawlmode in [Modes.INVM, Modes.OUTVM]:
            feature_options['per_cpu'] = True
            for (key, feature) in crawler.crawl_cpu(**feature_options):
                emitter.emit(key, feature)
        elif crawlmode in [Modes.OUTCONTAINER]:
            feature_options['per_cpu'] = False
            for (key, feature) in crawler.crawl_cpu(**feature_options):
                emitter.emit(key, feature)
        else:
            logger.warning('Cannot crawl feature: ' + feature +
                           ' in crawl mode: ' + crawlmode +
                           '. Skipping...')
    if feature == 'interface':
        if crawlmode in [Modes.INVM, Modes.OUTCONTAINER]:
            for (key, feature) in \
                    crawler.crawl_interface(**feature_options):
                emitter.emit(key, feature)
        else:
            logger.warning('Cannot crawl feature: ' + feature +
                           ' in crawl mode: ' + crawlmode +
                           '. Skipping...')
    if feature == 'load':
        if crawlmode in [Modes.INVM, Modes.OUTCONTAINER]:
            for (key, feature) in crawler.crawl_load(**feature_options):
                emitter.emit(key, feature)
        else:
            logger.warning('Cannot crawl feature: ' + feature +
                           ' in crawl mode: ' + crawlmode +
                           '. Skipping...')
    if feature == 'dockerps':
        if crawlmode in [Modes.INVM]:
            for (key, feature) in \
                    crawler.crawl_dockerps(**feature_options):
                emitter.emit(key, feature, 'dockerps')
        else:
            logger.warning('Cannot crawl feature: ' + feature +
                           ' in crawl mode: ' + crawlmode +
                           '. Skipping...')
    if feature == 'dockerhistory':
        if crawlmode in [Modes.OUTCONTAINER]:
            for (key, feature) in \
                    crawler.crawl_dockerhistory(**feature_options):
                emitter.emit(key, feature, 'dockerhistory')
        else:
            logger.warning('Cannot crawl feature: ' + feature +
                           ' in crawl mode: ' + crawlmode +
                           '. Skipping...')
    if feature == 'dockerinspect':
        if crawlmode in [Modes.OUTCONTAINER]:
            for (key, feature) in \
                    crawler.crawl_dockerinspect(**feature_options):
                emitter.emit(key, feature, 'dockerinspect')
        else:
            logger.warning('Cannot crawl feature: ' + feature +
                           ' in crawl mode: ' + crawlmode +
                           '. Skipping...')
    if feature == '_test_infinite_loop':
        for (key, feature) in \
                crawler.crawl_test_infinite_loop(**feature_options):
            emitter.emit(key, feature)
    if feature == '_test_crash':
        for (key, feature) in \
                crawler.crawl_test_crash(**feature_options):
            emitter.emit(key, feature)
dataset/ETHPy150Open cloudviz/agentless-system-crawler/crawler/crawlutils.py/_crawl_single_feature/original