<commit_before># Copyright ClusterHQ Inc.  See LICENSE file for details.

"""
Client for the Flocker REST API.
"""

from uuid import UUID, uuid4

from zope.interface import Interface, implementer

from pyrsistent import PClass, field, pmap_field, pmap

from twisted.internet.defer import succeed, fail


class Dataset(PClass):
    """
    A dataset in the configuration.

    :param UUID primary: The node where the dataset should manifest.
    :param int maximum_size: Size of new dataset, in bytes.
    :param dataset_id: The UUID of the dataset.
    :param metadata: A mapping between unicode keys and values.
    :param bool deleted: If true indicates this dataset should be deleted.
    """
    dataset_id = field(type=UUID)
    primary = field(type=UUID)
    maximum_size = field(type=int)
    deleted = field(type=bool)
    metadata = pmap_field(unicode, unicode)


class DatasetState(PClass):
    """
    The state of a dataset in the cluster.

    :param UUID primary: The node where the dataset should manifest.
    :param int maximum_size: Size of new dataset, in bytes.
    :param dataset_id: The UUID of the dataset.
    """
    dataset_id = field(type=UUID)
    primary = field(type=UUID)
    maximum_size = field(type=int)


class DatasetAlreadyExists(Exception):
    """
    The suggested dataset ID already exists.
    """


class IFlockerAPIV1(Interface):
    """
    The Flocker REST API, v1.
    """
    def create_dataset(primary, maximum_size, dataset_id=None,
                       metadata=pmap()):
        """
        Create a new dataset in the configuration.

        :param UUID primary: The node where the dataset should manifest.
        :param int maximum_size: Size of new dataset, in bytes.
        :param dataset_id: If given, the UUID to use for the dataset.
        :param metadata: A mapping between unicode keys and values, to be
            stored as dataset metadata.

        :return: ``Deferred`` firing with resulting ``Dataset``, or
            errbacking with ``DatasetAlreadyExists``.
        """<commit_msg>Address review comments: Fix docstring types.<commit_after># Copyright ClusterHQ Inc.  See LICENSE file for details.

"""
Client for the Flocker REST API.
"""

from uuid import UUID, uuid4

from zope.interface import Interface, implementer

from pyrsistent import PClass, field, pmap_field, pmap

from twisted.internet.defer import succeed, fail


class Dataset(PClass):
    """
    A dataset in the configuration.

    :attr UUID primary: The node where the dataset should manifest.
    :attr int maximum_size: Size of new dataset, in bytes.
    :attr UUID dataset_id: The UUID of the dataset.
    :attr metadata: A mapping between unicode keys and values.
    :attr bool deleted: If true indicates this dataset should be deleted.
    """
    dataset_id = field(type=UUID)
    primary = field(type=UUID)
    maximum_size = field(type=int)
    deleted = field(type=bool)
    metadata = pmap_field(unicode, unicode)


class DatasetState(PClass):
    """
    The state of a dataset in the cluster.

    :attr UUID primary: The node where the dataset should manifest.
    :attr int maximum_size: Size of new dataset, in bytes.
    :attr UUID dataset_id: The UUID of the dataset.
    """
    dataset_id = field(type=UUID)
    primary = field(type=UUID)
    maximum_size = field(type=int)


class DatasetAlreadyExists(Exception):
    """
    The suggested dataset ID already exists.
    """


class IFlockerAPIV1(Interface):
    """
    The Flocker REST API, v1.
    """
    def create_dataset(primary, maximum_size, dataset_id=None,
                       metadata=pmap()):
        """
        Create a new dataset in the configuration.

        :param UUID primary: The node where the dataset should manifest.
        :param int maximum_size: Size of new dataset, in bytes.
        :param dataset_id: If given, the UUID to use for the dataset.
        :param metadata: A mapping between unicode keys and values, to be
            stored as dataset metadata.

        :return: ``Deferred`` firing with resulting ``Dataset``, or
            errbacking with ``DatasetAlreadyExists``.
        """
{'fraction_non_alphanumeric': 0.08204633204633205, 'fraction_numerical': 0.0014478764478764478, 'mean_word_length': 3.004830917874396, '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': '2239948', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1147, 'n_words': 457}