<commit_before>from .dbase import DerivedBase
from .base import Property

class Config(DerivedBase):
    api_endpoint="/linodes/{linode_id}/configs/{id}" 
    derived_url_path="configs"

    properties = {
        "id": Property(identifier=True),
        "linode_id": Property(identifier=True),
        "helpers": Property(),#TODO: mutable=True),
        "created": Property(is_datetime=True),
        "root_device": Property(mutable=True),
        "kernel": Property(relationship=True, mutable=True),
        "disks": Property(),#TODO: mutable=True),
        "updated": Property(),
        "comments": Property(mutable=True),
        "label": Property(mutable=True),
        "kernel_params": Property(mutable=True),
    }

    def __init__(self, id, linode_id):
        DerivedBase.__init__(self, linode_id, parent_id_name='linode_id')

        self._set('id', id)<commit_msg>Configs now populate disks with relationships<commit_after>from .dbase import DerivedBase
from .base import Property

class Config(DerivedBase):
    api_endpoint="/linodes/{linode_id}/configs/{id}" 
    derived_url_path="configs"

    properties = {
        "id": Property(identifier=True),
        "linode_id": Property(identifier=True),
        "helpers": Property(),#TODO: mutable=True),
        "created": Property(is_datetime=True),
        "root_device": Property(mutable=True),
        "kernel": Property(relationship=True, mutable=True),
        "disks": Property(),#TODO: mutable=True),
        "updated": Property(),
        "comments": Property(mutable=True),
        "label": Property(mutable=True),
        "kernel_params": Property(mutable=True),
    }

    def __init__(self, id, linode_id):
        DerivedBase.__init__(self, linode_id, parent_id_name='linode_id')

        self._set('id', id)

    def _populate(self, json):
        """
        Override popupate to map the disks more nicely
        """
        DerivedBase._populate(self, json)

        import linode.mappings as mapper

        for key in vars(self.disks):
            print("Looking at {}".format(key))
            if self.disks.__getattribute__(key):
                self.disks.__setattr__(key, mapper.make(self.disks.__getattribute__(key).id, parent_id=self.linode_id))
{'fraction_non_alphanumeric': 0.138255033557047, 'fraction_numerical': 0.0, 'mean_word_length': 3.3249516441005804, 'pattern_counts': {'":': 22, '<': 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': '5252606', 'n_tokens_mistral': 680, 'n_tokens_neox': 663, 'n_words': 127}