<commit_before>from RequestHandler import RequestHandler
from QueryLayer import InfoQuery
from QueryLayer import DataQuery
from urllib2 import HTTPError
import numpy as np

class API(RequestHandler):

    def parse(self, request):

        super(API, self).parse(request)

        meths = self.INPUT.METHODS.LIST
        command = self._match_list('method',request,meths)

        if command == self.INPUT.METHODS.META.NAME:
            return self._get_meta_info()
        if command == self.INPUT.METHODS.FEAT.NAME:
            return self._get_feature_info()
        # Handle all methods the same if in same list
        if command in self.INPUT.METHODS.GROUP_LIST:
            return self._get_group(command)
        if command in self.INPUT.METHODS.IMAGE_LIST:
            return self.get_data(command)

        return 'Unsupported Request Category'

    '''
    Loads dictionary for info methods
    '''

    def _get_meta_info(self):
        # Get needed metadata
        info = self.OUTPUT.INFO
        meta_info = self._get_group_dict('')

        # Get requested query parameters
        out_format = self._get_list_query(self.INPUT.INFO.FORMAT)

        return InfoQuery(**{
            self.INPUT.METHODS.NAME: self.INPUT.METHODS.META.NAME,
            info.CHANNEL.NAME: meta_info[info.CHANNEL.NAME],
            info.TYPE.NAME: meta_info[info.TYPE.NAME],
            info.PATH.NAME: meta_info[info.PATH.NAME],
            info.SIZE.NAME: meta_info[info.SIZE.NAME],
            self.INPUT.INFO.FORMAT.NAME: out_format
        })

    def _get_feature_info(self):
        # Get needed metadata
        info = self.OUTPUT.INFO
        # meta_info = self._get_group_dict('')

        # Get requested query parameters
        out_format = self._get_list_query(self.INPUT.INFO.FORMAT)

        return InfoQuery(**{<commit_msg>no longer take datatype or dimensions from rh-config<commit_after>from RequestHandler import RequestHandler
from QueryLayer import InfoQuery
from QueryLayer import DataQuery
from urllib2 import HTTPError
import numpy as np

class API(RequestHandler):

    def parse(self, request):

        super(API, self).parse(request)

        meths = self.INPUT.METHODS.LIST
        command = self._match_list('method',request,meths)

        if command == self.INPUT.METHODS.META.NAME:
            return self._get_meta_info()
        if command == self.INPUT.METHODS.FEAT.NAME:
            return self._get_feature_info()
        # Handle all methods the same if in same list
        if command in self.INPUT.METHODS.GROUP_LIST:
            return self._get_group(command)
        if command in self.INPUT.METHODS.IMAGE_LIST:
            return self.get_data(command)

        return 'Unsupported Request Category'

    '''
    Loads dictionary for info methods
    '''

    def _get_meta_info(self):
        # Get needed metadata
        info = self.OUTPUT.INFO
        meta_info = self._get_group_dict('')

        # Get requested query parameters
        out_format = self._get_list_query(self.INPUT.INFO.FORMAT)

        return InfoQuery(**{
            self.INPUT.METHODS.NAME: self.INPUT.METHODS.META.NAME,
            info.CHANNEL.NAME: meta_info[info.CHANNEL.NAME],
            info.PATH.NAME: meta_info[info.PATH.NAME],
            self.INPUT.INFO.FORMAT.NAME: out_format
        })

    def _get_feature_info(self):
        # Get needed metadata
        info = self.OUTPUT.INFO
        # meta_info = self._get_group_dict('')

        # Get requested query parameters
        out_format = self._get_list_query(self.INPUT.INFO.FORMAT)

        return InfoQuery(**{
{'fraction_non_alphanumeric': 0.09035307200444816, 'fraction_numerical': 0.0005560189046427579, 'mean_word_length': 2.4696239151398265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6410158', 'n_tokens_mistral': 1037, 'n_tokens_neox': 1012, 'n_words': 236}