<commit_before>from __future__ import unicode_literals
import inspect
from faker import utils


class Documentor(object):

    def __init__(self, generator):
        """
        :param generator: a Generator localized and with providers already filled,
                          that we want write documentation
        :type generator: faker.Generator()
        """
        self.generator = generator
        self.max_name_len = 0
        self.already_generated = []

    def get_formatters(self, locale=None, excludes=None, **kwargs):

        self.max_name_len = 0
        self.already_generated = [] if excludes is None else excludes[:]
        formatters = []
        providers = self.generator.get_providers()
        for provider in providers[::-1]:  # reverse
            if locale and self.generator.provider(self.get_provider_name(provider)).__lang__ != locale:
                continue
            formatters.append(
                (provider, self.get_provider_formatters(provider, **kwargs))
            )
        return formatters

    def get_provider_formatters(self, provider, prefix='fake.', with_args=True, with_defaults=True):

        formatters = {}

        for name, method in inspect.getmembers(provider, inspect.ismethod):

            # skip 'private' method and inherited methods
            if name.startswith('_') or name in self.already_generated: continue

            arguments = []<commit_msg>Simplified getting __lang__ from provider<commit_after>from __future__ import unicode_literals
import inspect
from faker import utils


class Documentor(object):

    def __init__(self, generator):
        """
        :param generator: a Generator localized and with providers already filled,
                          that we want write documentation
        :type generator: faker.Generator()
        """
        self.generator = generator
        self.max_name_len = 0
        self.already_generated = []

    def get_formatters(self, locale=None, excludes=None, **kwargs):

        self.max_name_len = 0
        self.already_generated = [] if excludes is None else excludes[:]
        formatters = []
        providers = self.generator.get_providers()
        for provider in providers[::-1]:  # reverse
            if locale and provider.__lang__ != locale:
                continue
            formatters.append(
                (provider, self.get_provider_formatters(provider, **kwargs))
            )
        return formatters

    def get_provider_formatters(self, provider, prefix='fake.', with_args=True, with_defaults=True):

        formatters = {}

        for name, method in inspect.getmembers(provider, inspect.ismethod):

            # skip 'private' method and inherited methods
            if name.startswith('_') or name in self.already_generated: continue

            arguments = []
{'fraction_non_alphanumeric': 0.08577479703494528, 'fraction_numerical': 0.002117896223085069, 'mean_word_length': 2.4393203883495147, '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': '2928020', 'n_tokens_mistral': 736, 'n_tokens_neox': 697, 'n_words': 202}