<commit_before>from parse_rest.datatypes import Object


class State(Object):
    def as_dict(self):
        state = {}
        state['name'] = self.name
        state['capital'] = self.cap_city
        state['latitude'] = self.latitude
        state['longitude'] = self.longitude
        state['min-lat'] = self.min_latitude
        state['min-long'] = self.min_longitude
        state['max-lat'] = self.max_latitude
        state['max-long'] = self.max_longitude
        return state

    @staticmethod
    def get_all_states():
        result_set = []
        states = State.Query.all()
        for state in states:
            result_set.append(state.as_dict())
        return result_set

    @staticmethod
    def get_one_state(state_name_or_code):
        if state_name_or_code.len == 2:
            code = state_name_or_code.upper()
            state = State.Query.get(state_code=code)
            return state.as_dict()
        elif state_name_or_code.len > 2:
            state_name = state_name_or_code.capitalize()
            state = State.Query.get(name=state_name)
            return state.as_dict()




class LGA(Object):
    def as_dict(self):
        lga = {}
        lga["name"] = self.name
        return lga

    @staticmethod
    def get_all_lgas_with_state_name(state_name):
        result_set = []
        state_result = State.Query.get(name=state_name)
        print state_result.objectId
        lgas = LGA.Query.filter(state=state_result)
        for lga in lgas:
            result_set.append(lga.as_dict())
        return result_set

    @staticmethod
    def get_all_lgas(state_name_or_code):
        if len(state_name_or_code) == 2:
            code = state_name_or_code.upper()
            result_set = []<commit_msg>fix bug when trying to get state data<commit_after>from parse_rest.datatypes import Object


class State(Object):
    def as_dict(self):
        state = {}
        state['name'] = self.name
        state['capital'] = self.cap_city
        state['latitude'] = self.latitude
        state['longitude'] = self.longitude
        state['min-lat'] = self.min_latitude
        state['min-long'] = self.min_longitude
        state['max-lat'] = self.max_latitude
        state['max-long'] = self.max_longitude
        return state

    @staticmethod
    def get_all_states():
        result_set = []
        states = State.Query.all()
        for state in states:
            result_set.append(state.as_dict())
        return result_set

    @staticmethod
    def get_one_state(state_name_or_code):
        if len(state_name_or_code) == 2:
            code = state_name_or_code.upper()
            state = State.Query.get(state_code=code)
            return state.as_dict()
        elif len(state_name_or_code) > 2:
            state_name = state_name_or_code.capitalize()
            state = State.Query.get(name=state_name)
            return state.as_dict()




class LGA(Object):
    def as_dict(self):
        lga = {}
        lga["name"] = self.name
        return lga

    @staticmethod
    def get_all_lgas_with_state_name(state_name):
        result_set = []
        state_result = State.Query.get(name=state_name)
        print state_result.objectId
        lgas = LGA.Query.filter(state=state_result)
        for lga in lgas:
            result_set.append(lga.as_dict())
        return result_set

    @staticmethod
    def get_all_lgas(state_name_or_code):
        if len(state_name_or_code) == 2:
            code = state_name_or_code.upper()
            result_set = []
{'fraction_non_alphanumeric': 0.10221465076660988, 'fraction_numerical': 0.0017035775127768314, 'mean_word_length': 2.25, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5366099', 'n_tokens_mistral': 1128, 'n_tokens_neox': 1103, 'n_words': 199}