<commit_before>"""Base class used by all hvac api "category" classes."""
import logging
from abc import ABCMeta, abstractproperty

from hvac.api.vault_api_base import VaultApiBase

logger = logging.getLogger(__name__)


class VaultApiCategory(VaultApiBase):
    """Base class for API categories."""
    __metaclass__ = ABCMeta

    def __init__(self, adapter):
        """API Category class constructor.

        :param adapter: Instance of :py:class:`hvac.adapters.Adapter`; used for performing HTTP requests.
        :type adapter: hvac.adapters.Adapter
        """
        self._adapter = adapter
        self.implemented_class_names = []
        for implemented_class in self.implemented_classes:
            class_name = implemented_class.__name__.lower()
            self.implemented_class_names.append(class_name)
            auth_method_instance = implemented_class(adapter=adapter)
            setattr(self, self.get_private_attr_name(class_name), auth_method_instance)

        super(VaultApiCategory, self).__init__(adapter=adapter)

    def __getattr__(self, item):
        """Get an instance of an class instance in this category where available.

        :param item: Name of the class being requested.
        :type item: str | unicode
        :return: The requested class instance where available.
        :rtype: hvac.api.VaultApiBase
        """
        if item in self.implemented_class_names:
            private_attr_name = self.get_private_attr_name(item)
            return getattr(self, private_attr_name)
        if item in [u.lower() for u in self.unimplemented_classes]:
            raise NotImplementedError('"%s" auth method class not currently implemented.')<commit_msg>Template auth method not implemented error message<commit_after>"""Base class used by all hvac api "category" classes."""
import logging
from abc import ABCMeta, abstractproperty

from hvac.api.vault_api_base import VaultApiBase

logger = logging.getLogger(__name__)


class VaultApiCategory(VaultApiBase):
    """Base class for API categories."""
    __metaclass__ = ABCMeta

    def __init__(self, adapter):
        """API Category class constructor.

        :param adapter: Instance of :py:class:`hvac.adapters.Adapter`; used for performing HTTP requests.
        :type adapter: hvac.adapters.Adapter
        """
        self._adapter = adapter
        self.implemented_class_names = []
        for implemented_class in self.implemented_classes:
            class_name = implemented_class.__name__.lower()
            self.implemented_class_names.append(class_name)
            auth_method_instance = implemented_class(adapter=adapter)
            setattr(self, self.get_private_attr_name(class_name), auth_method_instance)

        super(VaultApiCategory, self).__init__(adapter=adapter)

    def __getattr__(self, item):
        """Get an instance of an class instance in this category where available.

        :param item: Name of the class being requested.
        :type item: str | unicode
        :return: The requested class instance where available.
        :rtype: hvac.api.VaultApiBase
        """
        if item in self.implemented_class_names:
            private_attr_name = self.get_private_attr_name(item)
            return getattr(self, private_attr_name)
        if item in [u.lower() for u in self.unimplemented_classes]:
            raise NotImplementedError('"%s" auth method class not currently implemented.' % item)
{'fraction_non_alphanumeric': 0.08101045296167247, 'fraction_numerical': 0.0, 'mean_word_length': 3.1961023142509135, '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': '5370937', 'n_tokens_mistral': 937, 'n_tokens_neox': 913, 'n_words': 264}