<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
High-level Entity interface.
"""

from hszinc import Ref
from .tags import ReadOnlyEntityTags, MutableEntityTags

class Entity(object):
    """
    A base class for Project Haystack entities.  This is a base class that is
    then combined with mix-ins depending on the tags present for the entity and
    the tagging model in use (by default, we use the "Project Haystack" tagging
    model, but others such as ISA-95 may exist).

    This base class just exposes the tags, and if supported by the server, may
    expose the ability to update those tags.
    """

    def __init__(self, session, entity_id):
        """
        Initialise a new high-level entity object.

        :param session: The connection session object.
        :param entity_id: The entity's fully qualified ID.
        """

        self._session = session
        self._entity_id = entity_id

        if hasattr(session, 'update'):
            tags = MutableEntityTags(self)
        else:
            tags = ReadOnlyEntityTags(self)

        self._tags = tags
        self._valid = True

    @property
    def id(self):
        """
        Return the fully qualified ID of this entity.
        """
        return Ref(self._entity_id)

    @property
    def tags(self):
        """
        Return the tags of this entity.
        """
        return self._tags
<commit_msg>client.entity.entity: Expose 'dis'<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
High-level Entity interface.
"""

from hszinc import Ref
from .tags import ReadOnlyEntityTags, MutableEntityTags

class Entity(object):
    """
    A base class for Project Haystack entities.  This is a base class that is
    then combined with mix-ins depending on the tags present for the entity and
    the tagging model in use (by default, we use the "Project Haystack" tagging
    model, but others such as ISA-95 may exist).

    This base class just exposes the tags, and if supported by the server, may
    expose the ability to update those tags.
    """

    def __init__(self, session, entity_id):
        """
        Initialise a new high-level entity object.

        :param session: The connection session object.
        :param entity_id: The entity's fully qualified ID.
        """

        self._session = session
        self._entity_id = entity_id

        if hasattr(session, 'update'):
            tags = MutableEntityTags(self)
        else:
            tags = ReadOnlyEntityTags(self)

        self._tags = tags
        self._valid = True

    @property
    def id(self):
        """
        Return the fully qualified ID of this entity.
        """
        return Ref(self._entity_id)

    @property
    def dis(self):
        """
        Return the description field of the entity.
        """
        return self._tags['dis']

    @property
    def tags(self):
        """
        Return the tags of this entity.
        """
        return self._tags

{'fraction_non_alphanumeric': 0.08461538461538462, 'fraction_numerical': 0.002006688963210702, 'mean_word_length': 2.1955128205128207, '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': '7569718', 'n_tokens_mistral': 816, 'n_tokens_neox': 788, 'n_words': 314}