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

class Disk(DerivedBase):
    api_endpoint = '/linodes/{linode_id}/disks/{id}'
    derived_url_path = 'disks'
    parent_id_name='linode_id'

    properties = {
        'id': Property(identifier=True),
        'created': Property(is_datetime=True),
        'label': Property(mutable=True),
        'size': Property(),
        'status': Property(),
        'type': Property(),
        'updated': Property(is_datetime=True),
        'linode_id': Property(identifier=True),
    }<commit_msg>Duplicate disks, reset root password<commit_after>from .dbase import DerivedBase
from .base import Property

class Disk(DerivedBase):
    api_endpoint = '/linodes/{linode_id}/disks/{id}'
    derived_url_path = 'disks'
    parent_id_name='linode_id'

    properties = {
        'id': Property(identifier=True),
        'created': Property(is_datetime=True),
        'label': Property(mutable=True),
        'size': Property(),
        'status': Property(),
        'type': Property(),
        'updated': Property(is_datetime=True),
        'linode_id': Property(identifier=True),
    }


    def duplicate(self):
        result = self._client.post(Disk.api_endpoint, model=self, data={})

        if not 'disk' in result:
            return result

        d = Disk(self._client, result['disk']['id'], self.id)
        d._populate(result['disk'])
        return d


    def reset_root_password(self, root_password=None):
        rpass = <PASSWORD>
        if not rpass:
            from .linode import Linode
            rpass = Linode.generate_root_password()

        params = {
            'password': rpass,
        }

        result = self._client.post(Disk.api_endpoint, model=self, data=params)

        if not 'disk' in result:
            if not root_password:
                return result, rpass
            return result

        self._populate(result['disk'])
        if not root_password:
            return True, rpass
        return True
{'fraction_non_alphanumeric': 0.12319920516641829, 'fraction_numerical': 0.0, 'mean_word_length': 2.508710801393728, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '883637', 'n_tokens_mistral': 592, 'n_tokens_neox': 575, 'n_words': 131}