コード例 #1
0
        def _get_fields_key(resource):
            """Returns the fields key from a resource dict

            """
            if resource['code'] in [HTTP_OK, HTTP_ACCEPTED]:
                if (MODEL_RE.match(resource_id) or
                        ANOMALY_RE.match(resource_id)):
                    return resource['object']['model']['model_fields']
                elif CLUSTER_RE.match(resource_id):
                    return resource['object']['clusters']['fields']
                elif CORRELATION_RE.match(resource_id):
                    return resource['object']['correlations']['fields']
                elif STATISTICAL_TEST_RE.match(resource_id):
                    return resource['object']['statistical_tests']['fields']
                elif LOGISTIC_REGRESSION_RE.match(resource_id):
                    return resource['object']['logistic_regression']['fields']
                elif ASSOCIATION_RE.match(resource_id):
                    return resource['object']['associations']['fields']
                elif TOPIC_MODEL_RE.match(resource_id):
                    return resource['object']['topic_model']['fields']
                elif TIME_SERIES_RE.match(resource_id):
                    return resource['object']['time_series']['fields']
                elif DEEPNET_RE.match(resource_id):
                    return resource['object']['deepnet']['fields']
                elif SAMPLE_RE.match(resource_id):
                    return dict([(field['id'], field) for field in
                                 resource['object']['sample']['fields']])
                elif PCA_RE.match(resource_id):
                    return dict([(field['id'], field) for field in
                                 resource['object']['pca']['fields']])
                elif LINEAR_REGRESSION_RE.match(resource_id):
                    return resource['object']['linear_regression']['fields']
                else:
                    return resource['object']['fields']
            return None
コード例 #2
0
ファイル: api.py プロジェクト: mmerce/python
        def _get_fields_key(resource):
            """Returns the fields key from a resource dict

            """
            if resource['code'] in [HTTP_OK, HTTP_ACCEPTED]:
                if (MODEL_RE.match(resource_id) or
                        ANOMALY_RE.match(resource_id)):
                    return resource['object']['model']['model_fields']
                elif CLUSTER_RE.match(resource_id):
                    return resource['object']['clusters']['fields']
                elif CORRELATION_RE.match(resource_id):
                    return resource['object']['correlations']['fields']
                elif STATISTICAL_TEST_RE.match(resource_id):
                    return resource['object']['statistical_tests']['fields']
                elif STATISTICAL_TEST_RE.match(resource_id):
                    return resource['object']['statistical_tests']['fields']
                elif LOGISTIC_REGRESSION_RE.match(resource_id):
                    return resource['object']['logistic_regression']['fields']
                elif ASSOCIATION_RE.match(resource_id):
                    return resource['object']['associations']['fields']
                elif TOPIC_MODEL_RE.match(resource_id):
                    return resource['object']['topic_model']['fields']
                elif SAMPLE_RE.match(resource_id):
                    return dict([(field['id'], field) for field in
                                 resource['object']['sample']['fields']])
                else:
                    return resource['object']['fields']
            return None