<commit_before>"""
api/serializers.py

Rest Framework Serializers
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

# App Imports
from .models import Category, Facility, Schedule, OpenTime, Location

# Other Imports
from rest_framework import serializers

class OpenTimeSerializer(serializers.ModelSerializer):
    """
    """
    class Meta:
        model = OpenTime
        fields = '__all__'

class CategorySerializer(serializers.ModelSerializer):
    """
    """
    class Meta:
        model = Category
        fields = '__all__'

class LocationSerializer(serializers.ModelSerializer):
    """
    """
    class Meta:
        model = Location
        fields = '__all__'

class ScheduleSerializer(serializers.ModelSerializer):
    """
    """
    open_times = OpenTimeSerializer(many=True, read_only=True)

    class Meta:
        model = Schedule
        fields = ('id', 'open_times', 'modified', 'name', 'valid_start',
                  'valid_end')

class FacilitySerializer(serializers.HyperlinkedModelSerializer):
    """
    """
    facility_category = CategorySerializer(many=False, read_only=True)
    facility_location = LocationSerializer(many=False, read_only=True)
    main_schedule = ScheduleSerializer(many=False, read_only=True)
    special_schedules = ScheduleSerializer(many=True, read_only=True)

    class Meta:
        model = Facility
        fields = ('id', 'facility_category', 'facility_location',
                  'main_schedule', 'special_schedules', 'modified', 'name')<commit_msg>Comment up serializers.py<commit_after>"""
api/serializers.py

Serializers allow complex data to be converted to native Python datatypes that
can then be easily rendered into JSON, XML or other content types.

http://www.django-rest-framework.org/api-guide/serializers
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

# App Imports
from .models import Category, Facility, Schedule, OpenTime, Location

# Other Imports
from rest_framework import serializers

class CategorySerializer(serializers.ModelSerializer):
    """
    Serializer for the Category model.
    """
    class Meta:
        # Choose the model to be serialized
        model = Category
        # Serialize all of the fields
        fields = '__all__'

class LocationSerializer(serializers.ModelSerializer):
    """
    Serializer for the Location model.
    """
    class Meta:
        # Choose the model to be serialized
        model = Location
        # Serialize all of the fields
        fields = '__all__'

class OpenTimeSerializer(serializers.ModelSerializer):
    """
    Serializer for the OpenTime model.
    """
    class Meta:
        # Choose the model to be serialized
        model = OpenTime
        # Serialize all of the fields
        fields = '__all__'

class ScheduleSerializer(serializers.ModelSerializer):
    """
    Serializer for the Schedule model.
    """
    # Append a serialized OpenTime object
    open_times = OpenTimeSerializer(many=True, read_only=True)

    class Meta:
        # Choose the model to be serialized
        model = Schedule
        # List the fields that we are serializing
        fields = ('id', 'open_times', 'modified', 'name', 'valid_start',
                  'valid_end')

class FacilitySerializer(serializers.HyperlinkedModelSerializer):
    """
    Serializer for the Facility model.
    """
    # Append a serialized Category object
    facility_category = CategorySerializer(many=False, read_only=True)
    # Append a serialized Location object
    facility_location = LocationSerializer(many=False, read_only=True)
    # Append a serialized Schedule object to represent main_schedule
    main_schedule = ScheduleSerializer(many=False, read_only=True)
    # Append a serialized Schedule object to represent special_schedules
    special_schedules = ScheduleSerializer(many=True, read_only=True)

    class Meta:
        # Choose the model to be serialized
        model = Facility
        # List the fields that we are serializing
        fields = ('id', 'facility_category', 'facility_location',
                  'main_schedule', 'special_schedules', 'modified', 'name')
{'fraction_non_alphanumeric': 0.0853601496725912, 'fraction_numerical': 0.0, 'mean_word_length': 3.2096456692913384, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '2988100', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1096, 'n_words': 330}