<commit_before>"""instance.py: Instance property"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import json
from warnings import warn

from six import PY2, text_type

from ..base import GENERIC_ERRORS, HasProperties, equal
from .. import basic
from .. import utils

if PY2:
    from types import ClassType                                                #pylint: disable=no-name-in-module
    CLASS_TYPES = (type, ClassType)
else:
    CLASS_TYPES = (type,)


class Instance(basic.Property):
    """Property for instances of a specified class

    **Instance** Properties may be used for any type, but they gain additional
    power with :ref:`hasproperties` types. The **Instance** Property may be
    assigned a dictionary with valid HasProperties class keywords; this is
    coerced to an instance of the HasProperties class. Also, HasProperties
    methods behave recursively, so if the parent HasProperties class is
    validated, serialized, etc., then HasProperties **Instance** Properties
    on the class will also be validated, serialized, etc.

    **Available keywords** (in addition to those inherited from
    :ref:`Property <property>`):
<commit_msg>Remove unused import<commit_after>"""instance.py: Instance property"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import json
from warnings import warn

from six import PY2

from ..base import GENERIC_ERRORS, HasProperties, equal
from .. import basic
from .. import utils

if PY2:
    from types import ClassType                                                #pylint: disable=no-name-in-module
    CLASS_TYPES = (type, ClassType)
else:
    CLASS_TYPES = (type,)


class Instance(basic.Property):
    """Property for instances of a specified class

    **Instance** Properties may be used for any type, but they gain additional
    power with :ref:`hasproperties` types. The **Instance** Property may be
    assigned a dictionary with valid HasProperties class keywords; this is
    coerced to an instance of the HasProperties class. Also, HasProperties
    methods behave recursively, so if the parent HasProperties class is
    validated, serialized, etc., then HasProperties **Instance** Properties
    on the class will also be validated, serialized, etc.

    **Available keywords** (in addition to those inherited from
    :ref:`Property <property>`):

{'fraction_non_alphanumeric': 0.06669297553275454, 'fraction_numerical': 0.0015785319652722968, 'mean_word_length': 3.7118959107806693, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1524734', 'n_tokens_mistral': 633, 'n_tokens_neox': 626, 'n_words': 285}