<commit_before>from flask.ext.restful import fields
from meta import BasicResource
from config.pins import PinManager

MANAGER = PinManager()


class Pin(BasicResource):

    def __init__(self):
        super(Pin, self).__init__()
        self.fields = {
            "num": fields.Integer,
            "mode": fields.String,
            "initial": fields.String,
            "resistor": fields.String
        }


class PinList(Pin):

    def get(self):
        return self.response(MANAGER.pins, 200)


class PinDetail(Pin):

    def get(self, pin_num):
        output = MANAGER.read(pin_num)
        if not output:
            return {'message': 'Pin not found'}, 404
        return self.response(output, 200)

    def put(self, pin_num):
        return {'pin': pin_num}

    def patch(self, pin_num):
        pass<commit_msg>Add extra field to detail output<commit_after>from flask.ext.restful import fields
from meta import BasicResource
from config.pins import PinManager

MANAGER = PinManager()


class Pin(BasicResource):

    def __init__(self):
        super(Pin, self).__init__()
        self.fields = {
            "num": fields.Integer,
            "mode": fields.String,
            "initial": fields.String,
            "resistor": fields.String
        }


class PinList(Pin):

    def get(self):
        return self.response(MANAGER.pins, 200)


class PinDetail(Pin):

    def __init__(self):
        super(PinDetail, self).__init__()
        self.fields['value'] = fields.Integer

    def get(self, pin_num):
        output = MANAGER.read(pin_num)
        if not output:
            return {'message': 'Pin not found'}, 404
        return self.response(output, 200)

    def put(self, pin_num):
        return {'pin': pin_num}

    def patch(self, pin_num):
        pass
{'fraction_non_alphanumeric': 0.11198208286674133, 'fraction_numerical': 0.010078387458006719, 'mean_word_length': 2.3780718336483933, 'pattern_counts': {'":': 8, '<': 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': '5588687', 'n_tokens_mistral': 566, 'n_tokens_neox': 520, 'n_words': 140}