<commit_before>from changes.api.serializer import Serializer, register
from changes.models import Command


@register(Command)
class CommandSerializer(Serializer):
    def serialize(self, instance, attrs):
        return {
            'id': instance.id.hex,
            'name': instance.label,
            'status': instance.status,
            'script': instance.script,
            'returnCode': instance.return_code,
            'env': dict(instance.env or {}),
            'cwd': instance.cwd,
            'artifacts': instance.artifacts or [],
            'duration': instance.duration,
            'dateCreated': instance.date_created,
            'dateStarted': instance.date_started,
            'dateFinished': instance.date_finished,
        }<commit_msg>Add type to command serialization<commit_after>from changes.api.serializer import Serializer, register
from changes.models import Command


@register(Command)
class CommandSerializer(Serializer):
    def serialize(self, instance, attrs):
        return {
            'id': instance.id.hex,
            'name': instance.label,
            'status': instance.status,
            'script': instance.script,
            'returnCode': instance.return_code,
            'env': dict(instance.env or {}),
            'cwd': instance.cwd,
            'type': instance.type,
            'artifacts': instance.artifacts or [],
            'duration': instance.duration,
            'dateCreated': instance.date_created,
            'dateStarted': instance.date_started,
            'dateFinished': instance.date_finished,
        }
{'fraction_non_alphanumeric': 0.11293375394321767, 'fraction_numerical': 0.0, 'mean_word_length': 2.331932773109244, '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': '962780', 'n_tokens_mistral': 405, 'n_tokens_neox': 403, 'n_words': 92}