prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Auto add builtin provider to Generic based on passed locale
  # Feature request
  
  An idea is very simple:
  
  ```python
  generic = Generic('ru', auto_add_builtin=True)
  generic.russia_provider.inn()
  ```
  
  Instead of this:
  
  ```python
  from mimesis import Generic
  from mimesis.builtins import RussiaSpecProvider
  
  generic = Generic('ru')
  generic.add_provider(RussiaSpecProvider)
  generic.russia_provider.inn()
  ```
  
  Optionally we can make builtin's name customizable: 
  
  ```python
  generic = Generic('ru', auto_add_builtin=True, builtin_custom_name='russia')
  generic.russia.inn()
  ```
  
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `mimesis/providers/generic.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 
  3 """Provides all at one."""
  4 
  5 import inspect
  6 from typing import Any, List, Type
  7 
  8 from mimesis.providers.address import Address
  9 from mimesis.providers.base import BaseDataProvider, BaseProvider
  10 from mimesis.providers.business import Business
  11 from mimesis.providers.choice import Choice
  12 from mimesis.providers.clothing import Clothing
  13 from mimesis.providers.code import Code
  14 from mimesis.providers.cryptographic import Cryptographic
  15 from mimesis.providers.date import Datetime
  16 from mimesis.providers.development import Development
  17 from mimesis.providers.file import File
  18 from mimesis.providers.food import Food
  19 from mimesis.providers.hardware import Hardware
  20 from mimesis.providers.internet import Internet
  21 from mimesis.providers.numbers import Numbers
  22 from mimesis.providers.path import Path
  23 from mimesis.providers.payment import Payment
  24 from mimesis.providers.person import Person
  25 from mimesis.providers.science import Science
  26 from mimesis.providers.structure import Structure
  27 from mimesis.providers.text import Text
  28 from mimesis.providers.transport import Transport
  29 from mimesis.providers.units import UnitSystem
  30 
  31 __all__ = ['Generic']
  32 
  33 
  34 class Generic(BaseDataProvider):
  35     """Class which contain all providers at one."""
  36 
  37     def __init__(self, *args, **kwargs) -> None:
  38         """Initialize attributes lazily.
  39 
  40         :param args: Arguments.
  41         :param kwargs: Keyword arguments.
  42         """
  43         super().__init__(*args, **kwargs)
  44         self._person = Person
  45         self._address = Address
  46         self._datetime = Datetime
  47         self._business = Business
  48         self._text = Text
  49         self._food = Food
  50         self._science = Science
  51         self.transport = Transport(seed=self.seed)
  52         self.code = Code(seed=self.seed)
  53         self.unit_system = UnitSystem(seed=self.seed)
  54         self.file = File(seed=self.seed)
  55         self.numbers = Numbers(seed=self.seed)
  56         self.development = Development(seed=self.seed)
  57         self.hardware = Hardware(seed=self.seed)
  58         self.clothing = Clothing(seed=self.seed)
  59         self.internet = Internet(seed=self.seed)
  60         self.path = Path(seed=self.seed)
  61         self.payment = Payment(seed=self.seed)
  62         self.cryptographic = Cryptographic(seed=self.seed)
  63         self.structure = Structure(seed=self.seed)
  64         self.choice = Choice(seed=self.seed)
  65 
  66     class Meta:
  67         """Class for metadata."""
  68 
  69         name = 'generic'
  70 
  71     def __getattr__(self, attrname: str) -> Any:
  72         """Get attribute without underscore.
  73 
  74         :param attrname: Attribute name.
  75         :return: An attribute.
  76         """
  77         attribute = object.__getattribute__(
  78             self, '_' + attrname)
  79         if attribute and callable(attribute):
  80             self.__dict__[attrname] = attribute(
  81                 self.locale,
  82                 self.seed,
  83             )
  84             return self.__dict__[attrname]
  85 
  86     def __dir__(self) -> List[str]:
  87         """Available data providers.
  88 
  89         The list of result will be used in AbstractField to
  90         determine method's class.
  91 
  92         :return: List of attributes.
  93         """
  94         attributes = []
  95         exclude = BaseDataProvider().__dict__.keys()
  96 
  97         for a in self.__dict__:
  98             if a not in exclude:
  99                 if a.startswith('_'):
  100                     attribute = a.replace('_', '', 1)
  101                     attributes.append(attribute)
  102                 else:
  103                     attributes.append(a)
  104         return attributes
  105 
  106     def add_provider(self, cls: Type[BaseProvider]) -> None:
  107         """Add a custom provider to Generic() object.
  108 
  109         :param cls: Custom provider.
  110         :return: None
  111         :raises TypeError: if cls is not class.
  112         """
  113         if inspect.isclass(cls):
  114             if not issubclass(cls, BaseProvider):
  115                 raise TypeError('The provider must be a '
  116                                 'subclass of BaseProvider')
  117             try:
  118                 meta = getattr(cls, 'Meta')
  119                 name = getattr(meta, 'name')
  120             except AttributeError:
  121                 name = cls.__name__.lower()
  122             setattr(self, name, cls(seed=self.seed))
  123         else:
  124             raise TypeError('The provider must be a class')
  125 
  126     def add_providers(self, *providers: Type[BaseProvider]) -> None:
  127         """Add a lot of custom providers to Generic() object.
  128 
  129         :param providers: Custom providers.
  130         :return: None
  131         """
  132         for provider in providers:
  133             self.add_provider(provider)
  134
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/mimesis/providers/generic.py b/mimesis/providers/generic.py
  --- a/mimesis/providers/generic.py
  +++ b/mimesis/providers/generic.py
  @@ -5,6 +5,17 @@
   import inspect
   from typing import Any, List, Type
   
  +from mimesis.builtins import (
  +    BrazilSpecProvider,
  +    DenmarkSpecProvider,
  +    GermanySpecProvider,
  +    ItalySpecProvider,
  +    NetherlandsSpecProvider,
  +    PolandSpecProvider,
  +    RussiaSpecProvider,
  +    UkraineSpecProvider,
  +    USASpecProvider,
  +)
   from mimesis.providers.address import Address
   from mimesis.providers.base import BaseDataProvider, BaseProvider
   from mimesis.providers.business import Business
  @@ -48,6 +59,21 @@
           self._text = Text
           self._food = Food
           self._science = Science
  +
  +        _spec_providers = {
  +            'de': DenmarkSpecProvider,
  +            'ge': GermanySpecProvider,
  +            'en': USASpecProvider,
  +            'it': ItalySpecProvider,
  +            'nl': NetherlandsSpecProvider,
  +            'pl': PolandSpecProvider,
  +            'pt-br': BrazilSpecProvider,
  +            'ru': RussiaSpecProvider,
  +            'uk': UkraineSpecProvider,
  +        }
  +        if self.locale in _spec_providers:
  +            self.add_provider(_spec_providers[self.locale])
  +
           self.transport = Transport(seed=self.seed)
           self.code = Code(seed=self.seed)
           self.unit_system = UnitSystem(seed=self.seed)
  @@ -108,7 +134,8 @@
   
           :param cls: Custom provider.
           :return: None
  -        :raises TypeError: if cls is not class.
  +        :raises TypeError: if cls is not class or is not a subclass
  +            of BaseProvider.
           """
           if inspect.isclass(cls):
               if not issubclass(cls, BaseProvider):
  
verification_info: {"golden_diff": "diff --git a/mimesis/providers/generic.py b/mimesis/providers/generic.py\n--- a/mimesis/providers/generic.py\n+++ b/mimesis/providers/generic.py\n@@ -5,6 +5,17 @@\n import inspect\n from typing import Any, List, Type\n \n+from mimesis.builtins import (\n+    BrazilSpecProvider,\n+    DenmarkSpecProvider,\n+    GermanySpecProvider,\n+    ItalySpecProvider,\n+    NetherlandsSpecProvider,\n+    PolandSpecProvider,\n+    RussiaSpecProvider,\n+    UkraineSpecProvider,\n+    USASpecProvider,\n+)\n from mimesis.providers.address import Address\n from mimesis.providers.base import BaseDataProvider, BaseProvider\n from mimesis.providers.business import Business\n@@ -48,6 +59,21 @@\n         self._text = Text\n         self._food = Food\n         self._science = Science\n+\n+        _spec_providers = {\n+            'de': DenmarkSpecProvider,\n+            'ge': GermanySpecProvider,\n+            'en': USASpecProvider,\n+            'it': ItalySpecProvider,\n+            'nl': NetherlandsSpecProvider,\n+            'pl': PolandSpecProvider,\n+            'pt-br': BrazilSpecProvider,\n+            'ru': RussiaSpecProvider,\n+            'uk': UkraineSpecProvider,\n+        }\n+        if self.locale in _spec_providers:\n+            self.add_provider(_spec_providers[self.locale])\n+\n         self.transport = Transport(seed=self.seed)\n         self.code = Code(seed=self.seed)\n         self.unit_system = UnitSystem(seed=self.seed)\n@@ -108,7 +134,8 @@\n \n         :param cls: Custom provider.\n         :return: None\n-        :raises TypeError: if cls is not class.\n+        :raises TypeError: if cls is not class or is not a subclass\n+            of BaseProvider.\n         \"\"\"\n         if inspect.isclass(cls):\n             if not issubclass(cls, BaseProvider):\n", "issue": "Auto add builtin provider to Generic based on passed locale\n# Feature request\r\n\r\nAn idea is very simple:\r\n\r\n```python\r\ngeneric = Generic('ru', auto_add_builtin=True)\r\ngeneric.russia_provider.inn()\r\n```\r\n\r\nInstead of this:\r\n\r\n```python\r\nfrom mimesis import Generic\r\nfrom mimesis.builtins import RussiaSpecProvider\r\n\r\ngeneric = Generic('ru')\r\ngeneric.add_provider(RussiaSpecProvider)\r\ngeneric.russia_provider.inn()\r\n```\r\n\r\nOptionally we can make builtin's name customizable: \r\n\r\n```python\r\ngeneric = Generic('ru', auto_add_builtin=True, builtin_custom_name='russia')\r\ngeneric.russia.inn()\r\n```\r\n\r\n\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Provides all at one.\"\"\"\n\nimport inspect\nfrom typing import Any, List, Type\n\nfrom mimesis.providers.address import Address\nfrom mimesis.providers.base import BaseDataProvider, BaseProvider\nfrom mimesis.providers.business import Business\nfrom mimesis.providers.choice import Choice\nfrom mimesis.providers.clothing import Clothing\nfrom mimesis.providers.code import Code\nfrom mimesis.providers.cryptographic import Cryptographic\nfrom mimesis.providers.date import Datetime\nfrom mimesis.providers.development import Development\nfrom mimesis.providers.file import File\nfrom mimesis.providers.food import Food\nfrom mimesis.providers.hardware import Hardware\nfrom mimesis.providers.internet import Internet\nfrom mimesis.providers.numbers import Numbers\nfrom mimesis.providers.path import Path\nfrom mimesis.providers.payment import Payment\nfrom mimesis.providers.person import Person\nfrom mimesis.providers.science import Science\nfrom mimesis.providers.structure import Structure\nfrom mimesis.providers.text import Text\nfrom mimesis.providers.transport import Transport\nfrom mimesis.providers.units import UnitSystem\n\n__all__ = ['Generic']\n\n\nclass Generic(BaseDataProvider):\n    \"\"\"Class which contain all providers at one.\"\"\"\n\n    def __init__(self, *args, **kwargs) -> None:\n        \"\"\"Initialize attributes lazily.\n\n        :param args: Arguments.\n        :param kwargs: Keyword arguments.\n        \"\"\"\n        super().__init__(*args, **kwargs)\n        self._person = Person\n        self._address = Address\n        self._datetime = Datetime\n        self._business = Business\n        self._text = Text\n        self._food = Food\n        self._science = Science\n        self.transport = Transport(seed=self.seed)\n        self.code = Code(seed=self.seed)\n        self.unit_system = UnitSystem(seed=self.seed)\n        self.file = File(seed=self.seed)\n        self.numbers = Numbers(seed=self.seed)\n        self.development = Development(seed=self.seed)\n        self.hardware = Hardware(seed=self.seed)\n        self.clothing = Clothing(seed=self.seed)\n        self.internet = Internet(seed=self.seed)\n        self.path = Path(seed=self.seed)\n        self.payment = Payment(seed=self.seed)\n        self.cryptographic = Cryptographic(seed=self.seed)\n        self.structure = Structure(seed=self.seed)\n        self.choice = Choice(seed=self.seed)\n\n    class Meta:\n        \"\"\"Class for metadata.\"\"\"\n\n        name = 'generic'\n\n    def __getattr__(self, attrname: str) -> Any:\n        \"\"\"Get attribute without underscore.\n\n        :param attrname: Attribute name.\n        :return: An attribute.\n        \"\"\"\n        attribute = object.__getattribute__(\n            self, '_' + attrname)\n        if attribute and callable(attribute):\n            self.__dict__[attrname] = attribute(\n                self.locale,\n                self.seed,\n            )\n            return self.__dict__[attrname]\n\n    def __dir__(self) -> List[str]:\n        \"\"\"Available data providers.\n\n        The list of result will be used in AbstractField to\n        determine method's class.\n\n        :return: List of attributes.\n        \"\"\"\n        attributes = []\n        exclude = BaseDataProvider().__dict__.keys()\n\n        for a in self.__dict__:\n            if a not in exclude:\n                if a.startswith('_'):\n                    attribute = a.replace('_', '', 1)\n                    attributes.append(attribute)\n                else:\n                    attributes.append(a)\n        return attributes\n\n    def add_provider(self, cls: Type[BaseProvider]) -> None:\n        \"\"\"Add a custom provider to Generic() object.\n\n        :param cls: Custom provider.\n        :return: None\n        :raises TypeError: if cls is not class.\n        \"\"\"\n        if inspect.isclass(cls):\n            if not issubclass(cls, BaseProvider):\n                raise TypeError('The provider must be a '\n                                'subclass of BaseProvider')\n            try:\n                meta = getattr(cls, 'Meta')\n                name = getattr(meta, 'name')\n            except AttributeError:\n                name = cls.__name__.lower()\n            setattr(self, name, cls(seed=self.seed))\n        else:\n            raise TypeError('The provider must be a class')\n\n    def add_providers(self, *providers: Type[BaseProvider]) -> None:\n        \"\"\"Add a lot of custom providers to Generic() object.\n\n        :param providers: Custom providers.\n        :return: None\n        \"\"\"\n        for provider in providers:\n            self.add_provider(provider)\n", "path": "mimesis/providers/generic.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Provides all at one.\"\"\"\n\nimport inspect\nfrom typing import Any, List, Type\n\nfrom mimesis.builtins import (\n    BrazilSpecProvider,\n    DenmarkSpecProvider,\n    GermanySpecProvider,\n    ItalySpecProvider,\n    NetherlandsSpecProvider,\n    PolandSpecProvider,\n    RussiaSpecProvider,\n    UkraineSpecProvider,\n    USASpecProvider,\n)\nfrom mimesis.providers.address import Address\nfrom mimesis.providers.base import BaseDataProvider, BaseProvider\nfrom mimesis.providers.business import Business\nfrom mimesis.providers.choice import Choice\nfrom mimesis.providers.clothing import Clothing\nfrom mimesis.providers.code import Code\nfrom mimesis.providers.cryptographic import Cryptographic\nfrom mimesis.providers.date import Datetime\nfrom mimesis.providers.development import Development\nfrom mimesis.providers.file import File\nfrom mimesis.providers.food import Food\nfrom mimesis.providers.hardware import Hardware\nfrom mimesis.providers.internet import Internet\nfrom mimesis.providers.numbers import Numbers\nfrom mimesis.providers.path import Path\nfrom mimesis.providers.payment import Payment\nfrom mimesis.providers.person import Person\nfrom mimesis.providers.science import Science\nfrom mimesis.providers.structure import Structure\nfrom mimesis.providers.text import Text\nfrom mimesis.providers.transport import Transport\nfrom mimesis.providers.units import UnitSystem\n\n__all__ = ['Generic']\n\n\nclass Generic(BaseDataProvider):\n    \"\"\"Class which contain all providers at one.\"\"\"\n\n    def __init__(self, *args, **kwargs) -> None:\n        \"\"\"Initialize attributes lazily.\n\n        :param args: Arguments.\n        :param kwargs: Keyword arguments.\n        \"\"\"\n        super().__init__(*args, **kwargs)\n        self._person = Person\n        self._address = Address\n        self._datetime = Datetime\n        self._business = Business\n        self._text = Text\n        self._food = Food\n        self._science = Science\n\n        _spec_providers = {\n            'de': DenmarkSpecProvider,\n            'ge': GermanySpecProvider,\n            'en': USASpecProvider,\n            'it': ItalySpecProvider,\n            'nl': NetherlandsSpecProvider,\n            'pl': PolandSpecProvider,\n            'pt-br': BrazilSpecProvider,\n            'ru': RussiaSpecProvider,\n            'uk': UkraineSpecProvider,\n        }\n        if self.locale in _spec_providers:\n            self.add_provider(_spec_providers[self.locale])\n\n        self.transport = Transport(seed=self.seed)\n        self.code = Code(seed=self.seed)\n        self.unit_system = UnitSystem(seed=self.seed)\n        self.file = File(seed=self.seed)\n        self.numbers = Numbers(seed=self.seed)\n        self.development = Development(seed=self.seed)\n        self.hardware = Hardware(seed=self.seed)\n        self.clothing = Clothing(seed=self.seed)\n        self.internet = Internet(seed=self.seed)\n        self.path = Path(seed=self.seed)\n        self.payment = Payment(seed=self.seed)\n        self.cryptographic = Cryptographic(seed=self.seed)\n        self.structure = Structure(seed=self.seed)\n        self.choice = Choice(seed=self.seed)\n\n    class Meta:\n        \"\"\"Class for metadata.\"\"\"\n\n        name = 'generic'\n\n    def __getattr__(self, attrname: str) -> Any:\n        \"\"\"Get attribute without underscore.\n\n        :param attrname: Attribute name.\n        :return: An attribute.\n        \"\"\"\n        attribute = object.__getattribute__(\n            self, '_' + attrname)\n        if attribute and callable(attribute):\n            self.__dict__[attrname] = attribute(\n                self.locale,\n                self.seed,\n            )\n            return self.__dict__[attrname]\n\n    def __dir__(self) -> List[str]:\n        \"\"\"Available data providers.\n\n        The list of result will be used in AbstractField to\n        determine method's class.\n\n        :return: List of attributes.\n        \"\"\"\n        attributes = []\n        exclude = BaseDataProvider().__dict__.keys()\n\n        for a in self.__dict__:\n            if a not in exclude:\n                if a.startswith('_'):\n                    attribute = a.replace('_', '', 1)\n                    attributes.append(attribute)\n                else:\n                    attributes.append(a)\n        return attributes\n\n    def add_provider(self, cls: Type[BaseProvider]) -> None:\n        \"\"\"Add a custom provider to Generic() object.\n\n        :param cls: Custom provider.\n        :return: None\n        :raises TypeError: if cls is not class or is not a subclass\n            of BaseProvider.\n        \"\"\"\n        if inspect.isclass(cls):\n            if not issubclass(cls, BaseProvider):\n                raise TypeError('The provider must be a '\n                                'subclass of BaseProvider')\n            try:\n                meta = getattr(cls, 'Meta')\n                name = getattr(meta, 'name')\n            except AttributeError:\n                name = cls.__name__.lower()\n            setattr(self, name, cls(seed=self.seed))\n        else:\n            raise TypeError('The provider must be a class')\n\n    def add_providers(self, *providers: Type[BaseProvider]) -> None:\n        \"\"\"Add a lot of custom providers to Generic() object.\n\n        :param providers: Custom providers.\n        :return: None\n        \"\"\"\n        for provider in providers:\n            self.add_provider(provider)\n", "path": "mimesis/providers/generic.py"}]}