<commit_before>from flask.ext.restful import Resource

from sqlalchemy import func

from .application import app
from .models import User, Location


class GetLocationsResource(Resource):

    def get(self):
        locations = app.db.session.query(Location).all()

        locations_json = []
        for location in locations:
            loc = {
                "name": location.name,
            }

            if location.services is not None:
                services_json = []
                for service in location.services:
                    services_json.append(str(service))

                if len(services_json) > 0:
                    loc["services"] = services_json

            if location.days_of_week is not None:
                days_of_week_json = []
                for day in location.days_of_week:
                    days_of_week_json.append(str(day))

                if len(days_of_week_json) > 0:
                    loc["days"] = days_of_week_json

            if location.address_line1 is not None:
                loc["address_line1"] = str(location.address_line1)

            if location.address_line2 is not None:
                loc["address_line2"] = str(location.address_line2)

            if location.address_line3 is not None:<commit_msg>Add Location description to API<commit_after>from flask.ext.restful import Resource

from sqlalchemy import func

from .application import app
from .models import User, Location


class GetLocationsResource(Resource):

    def get(self):
        locations = app.db.session.query(Location).all()

        locations_json = []
        for location in locations:
            loc = {
                "name": location.name,
            }

            if location.services is not None:
                services_json = []
                for service in location.services:
                    services_json.append(str(service))

                if len(services_json) > 0:
                    loc["services"] = services_json

            if location.days_of_week is not None:
                days_of_week_json = []
                for day in location.days_of_week:
                    days_of_week_json.append(str(day))

                if len(days_of_week_json) > 0:
                    loc["days"] = days_of_week_json

            if location.description is not None:
                loc["description"] = str(location.description)

            if location.address_line1 is not None:
                loc["address_line1"] = str(location.address_line1)

            if location.address_line2 is not None:
                loc["address_line2"] = str(location.address_line2)

            if location.address_line3 is not None:
{'fraction_non_alphanumeric': 0.07723728184181211, 'fraction_numerical': 0.006683995544002971, 'mean_word_length': 1.7602459016393444, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, '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': '4346074', 'n_tokens_mistral': 734, 'n_tokens_neox': 677, 'n_words': 174}