<commit_before># Copyright (c) 2014 Ansible, Inc.
# All Rights Reserved.

from django.conf import settings
from django.db import models
from django.utils.functional import cached_property


class InstanceManager(models.Manager):
    """A custom manager class for the Instance model.

    Provides "table-level" methods including getting the currently active
    instance or role.
    """
    @cached_property
    def me(self):
        """Return the currently active instance."""
        return self.get(uuid=settings.SYSTEM_UUID)

    @cached_property
    def my_role(self):
        """Return the role of the currently active instance, as a string
        ('primary' or 'secondary').
        """
        if self.me.primary:
            return 'primary'
        return 'secondary'<commit_msg>Thinking better of making the manager methods properties.<commit_after># Copyright (c) 2014 Ansible, Inc.
# All Rights Reserved.

from django.conf import settings
from django.db import models
from django.utils.functional import cached_property


class InstanceManager(models.Manager):
    """A custom manager class for the Instance model.

    Provides "table-level" methods including getting the currently active
    instance or role.
    """
    def me(self):
        """Return the currently active instance."""
        return self.get(uuid=settings.SYSTEM_UUID)

    def my_role(self):
        """Return the role of the currently active instance, as a string
        ('primary' or 'secondary').
        """
        if self.me().primary:
            return 'primary'
        return 'secondary'
{'fraction_non_alphanumeric': 0.08890290037831021, 'fraction_numerical': 0.005044136191677175, 'mean_word_length': 3.017721518987342, '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': '2840072', 'n_tokens_mistral': 409, 'n_tokens_neox': 396, 'n_words': 154}