prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add UUID objects support for uuid()
  - [x] Add parameter `as_object` 
  
  --- 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/__init__.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 
  3 """Mimesis is a Python library, which helps generate fake data.
  4 
  5 Copyright (c) 2016 - 2020 Isaak Uchakaev (Likid Geimfari)
  6 Repository: https://github.com/lk-geimfari/mimesis
  7 Email: <likid.geimfari@gmail.com>
  8 """
  9 
  10 from mimesis.providers import (
  11     Address,
  12     BaseDataProvider,
  13     BaseProvider,
  14     Business,
  15     Choice,
  16     Clothing,
  17     Code,
  18     Cryptographic,
  19     Datetime,
  20     Development,
  21     File,
  22     Food,
  23     Generic,
  24     Hardware,
  25     Internet,
  26     Numbers,
  27     Path,
  28     Payment,
  29     Person,
  30     Science,
  31     Structure,
  32     Text,
  33     Transport,
  34     UnitSystem,
  35 )
  36 
  37 __all__ = [
  38     'Address',
  39     'BaseDataProvider',
  40     'BaseProvider',
  41     'Business',
  42     'Clothing',
  43     'Code',
  44     'Choice',
  45     'Datetime',
  46     'Development',
  47     'File',
  48     'Food',
  49     'Hardware',
  50     'Internet',
  51     'Numbers',
  52     'Path',
  53     'Payment',
  54     'Person',
  55     'Science',
  56     'Structure',
  57     'Text',
  58     'Transport',
  59     'UnitSystem',
  60     'Cryptographic',
  61 
  62     # Has all:
  63     'Generic',
  64 
  65     # Meta:
  66     '__version__',
  67     '__title__',
  68     '__description__',
  69     '__url__',
  70     '__author__',
  71     '__author_email__',
  72     '__license__',
  73 ]
  74 
  75 __version__ = '4.0.0'
  76 __title__ = 'mimesis'
  77 __description__ = 'Mimesis: fake data generator.'
  78 __url__ = 'https://github.com/lk-geimfari/mimesis'
  79 __author__ = 'Isaak Uchakaev (Likid Geimfari)'
  80 __author_email__ = 'likid.geimfari@gmail.com'
  81 __license__ = 'MIT License'
  82
  ```
  
  Path: `mimesis/providers/cryptographic.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 
  3 """Cryptographic data provider."""
  4 
  5 import hashlib
  6 import secrets
  7 import uuid
  8 from typing import Optional
  9 
  10 from mimesis.enums import Algorithm
  11 from mimesis.providers.base import BaseProvider
  12 from mimesis.providers.text import Text
  13 
  14 __all__ = ['Cryptographic']
  15 
  16 
  17 class Cryptographic(BaseProvider):
  18     """Class that provides cryptographic data."""
  19 
  20     def __init__(self, *args, **kwargs) -> None:
  21         """Initialize attributes.
  22 
  23         :param seed: Seed.
  24         """
  25         super().__init__(*args, **kwargs)
  26         self.__words = Text('en')._data.get('words', {})
  27 
  28     class Meta:
  29         """Class for metadata."""
  30 
  31         name = 'cryptographic'
  32 
  33     def uuid(self, version: int = None) -> str:
  34         """Generate random UUID.
  35 
  36         :param version: UUID version.
  37         :return: UUID
  38         """
  39         bits = self.random.getrandbits(128)
  40         return str(uuid.UUID(int=bits, version=version))
  41 
  42     def hash(self, algorithm: Algorithm = None) -> str:  # noqa: A003
  43         """Generate random hash.
  44 
  45         To change hashing algorithm, pass parameter ``algorithm``
  46         with needed value of the enum object :class:`~mimesis.enums.Algorithm`
  47 
  48         :param algorithm: Enum object :class:`~mimesis.enums.Algorithm`.
  49         :return: Hash.
  50         :raises NonEnumerableError: When algorithm is unsupported.
  51         """
  52         key = self._validate_enum(algorithm, Algorithm)
  53 
  54         if hasattr(hashlib, key):
  55             fn = getattr(hashlib, key)
  56             return fn(self.uuid().encode()).hexdigest()
  57 
  58     @staticmethod
  59     def token_bytes(entropy: int = 32) -> bytes:
  60         """Generate byte string containing ``entropy`` bytes.
  61 
  62         The string has ``entropy`` random bytes, each byte
  63         converted to two hex digits.
  64 
  65         .. warning:: Seed is not applicable to this method,
  66             because of its cryptographic-safe nature.
  67 
  68         :param entropy: Number of bytes (default: 32).
  69         :return: Random bytes.
  70         """
  71         return secrets.token_bytes(entropy)
  72 
  73     @staticmethod
  74     def token_hex(entropy: int = 32) -> str:
  75         """Return a random text string, in hexadecimal.
  76 
  77         The string has *entropy* random bytes, each byte converted to two
  78         hex digits.  If *entropy* is ``None`` or not supplied, a reasonable
  79         default is used.
  80 
  81         .. warning:: Seed is not applicable to this method,
  82             because of its cryptographic-safe nature.
  83 
  84         :param entropy: Number of bytes (default: 32).
  85         :return: Token.
  86         """
  87         return secrets.token_hex(entropy)
  88 
  89     @staticmethod
  90     def token_urlsafe(entropy: int = 32):
  91         """Return a random URL-safe text string, in Base64 encoding.
  92 
  93         The string has *entropy* random bytes.  If *entropy* is ``None``
  94         or not supplied, a reasonable default is used.
  95 
  96         .. warning:: Seed is not applicable to this method,
  97             because of its cryptographic-safe nature.
  98 
  99         :param entropy: Number of bytes (default: 32).
  100         :return: URL-safe token.
  101         """
  102         return secrets.token_urlsafe(entropy)
  103 
  104     def mnemonic_phrase(self, length: int = 12,
  105                         separator: Optional[str] = None) -> str:
  106         """Generate pseudo mnemonic phrase.
  107 
  108         Please, keep in mind that this method generates
  109         crypto-insecure values.
  110 
  111         :param separator: Separator of phrases (Default is " ").
  112         :param length: Number of words.
  113         :return: Mnemonic phrase.
  114         """
  115         if not separator:
  116             separator = ' '
  117 
  118         words = self.__words['normal']
  119         words_generator = (self.random.choice(words) for _ in range(length))
  120         return '{}'.format(separator).join(words_generator)
  121
  ```
  --- 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/__init__.py b/mimesis/__init__.py
  --- a/mimesis/__init__.py
  +++ b/mimesis/__init__.py
  @@ -72,7 +72,7 @@
       '__license__',
   ]
   
  -__version__ = '4.0.0'
  +__version__ = '4.1.0'
   __title__ = 'mimesis'
   __description__ = 'Mimesis: fake data generator.'
   __url__ = 'https://github.com/lk-geimfari/mimesis'
  diff --git a/mimesis/providers/cryptographic.py b/mimesis/providers/cryptographic.py
  --- a/mimesis/providers/cryptographic.py
  +++ b/mimesis/providers/cryptographic.py
  @@ -4,8 +4,8 @@
   
   import hashlib
   import secrets
  -import uuid
  -from typing import Optional
  +from typing import Optional, Union
  +from uuid import UUID
   
   from mimesis.enums import Algorithm
   from mimesis.providers.base import BaseProvider
  @@ -30,14 +30,25 @@
   
           name = 'cryptographic'
   
  -    def uuid(self, version: int = None) -> str:
  +    def uuid(self, version: int = None,
  +             as_object: bool = False) -> Union[UUID, str]:
           """Generate random UUID.
   
  +        This method returns string by default,
  +        but yoy can make it return uuid.UUID object using
  +        parameter **as_object**
  +
  +        :param as_object: Returns uuid.UUID object instead of string.
           :param version: UUID version.
  -        :return: UUID
  +        :return: UUID.
           """
           bits = self.random.getrandbits(128)
  -        return str(uuid.UUID(int=bits, version=version))
  +        uuid_obj = UUID(int=bits, version=version)
  +
  +        if not as_object:
  +            return str(uuid_obj)
  +
  +        return uuid_obj
   
       def hash(self, algorithm: Algorithm = None) -> str:  # noqa: A003
           """Generate random hash.
  
verification_info: {"golden_diff": "diff --git a/mimesis/__init__.py b/mimesis/__init__.py\n--- a/mimesis/__init__.py\n+++ b/mimesis/__init__.py\n@@ -72,7 +72,7 @@\n     '__license__',\n ]\n \n-__version__ = '4.0.0'\n+__version__ = '4.1.0'\n __title__ = 'mimesis'\n __description__ = 'Mimesis: fake data generator.'\n __url__ = 'https://github.com/lk-geimfari/mimesis'\ndiff --git a/mimesis/providers/cryptographic.py b/mimesis/providers/cryptographic.py\n--- a/mimesis/providers/cryptographic.py\n+++ b/mimesis/providers/cryptographic.py\n@@ -4,8 +4,8 @@\n \n import hashlib\n import secrets\n-import uuid\n-from typing import Optional\n+from typing import Optional, Union\n+from uuid import UUID\n \n from mimesis.enums import Algorithm\n from mimesis.providers.base import BaseProvider\n@@ -30,14 +30,25 @@\n \n         name = 'cryptographic'\n \n-    def uuid(self, version: int = None) -> str:\n+    def uuid(self, version: int = None,\n+             as_object: bool = False) -> Union[UUID, str]:\n         \"\"\"Generate random UUID.\n \n+        This method returns string by default,\n+        but yoy can make it return uuid.UUID object using\n+        parameter **as_object**\n+\n+        :param as_object: Returns uuid.UUID object instead of string.\n         :param version: UUID version.\n-        :return: UUID\n+        :return: UUID.\n         \"\"\"\n         bits = self.random.getrandbits(128)\n-        return str(uuid.UUID(int=bits, version=version))\n+        uuid_obj = UUID(int=bits, version=version)\n+\n+        if not as_object:\n+            return str(uuid_obj)\n+\n+        return uuid_obj\n \n     def hash(self, algorithm: Algorithm = None) -> str:  # noqa: A003\n         \"\"\"Generate random hash.\n", "issue": "Add UUID objects support for uuid()\n- [x] Add parameter `as_object` \n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Mimesis is a Python library, which helps generate fake data.\n\nCopyright (c) 2016 - 2020 Isaak Uchakaev (Likid Geimfari)\nRepository: https://github.com/lk-geimfari/mimesis\nEmail: <likid.geimfari@gmail.com>\n\"\"\"\n\nfrom mimesis.providers import (\n    Address,\n    BaseDataProvider,\n    BaseProvider,\n    Business,\n    Choice,\n    Clothing,\n    Code,\n    Cryptographic,\n    Datetime,\n    Development,\n    File,\n    Food,\n    Generic,\n    Hardware,\n    Internet,\n    Numbers,\n    Path,\n    Payment,\n    Person,\n    Science,\n    Structure,\n    Text,\n    Transport,\n    UnitSystem,\n)\n\n__all__ = [\n    'Address',\n    'BaseDataProvider',\n    'BaseProvider',\n    'Business',\n    'Clothing',\n    'Code',\n    'Choice',\n    'Datetime',\n    'Development',\n    'File',\n    'Food',\n    'Hardware',\n    'Internet',\n    'Numbers',\n    'Path',\n    'Payment',\n    'Person',\n    'Science',\n    'Structure',\n    'Text',\n    'Transport',\n    'UnitSystem',\n    'Cryptographic',\n\n    # Has all:\n    'Generic',\n\n    # Meta:\n    '__version__',\n    '__title__',\n    '__description__',\n    '__url__',\n    '__author__',\n    '__author_email__',\n    '__license__',\n]\n\n__version__ = '4.0.0'\n__title__ = 'mimesis'\n__description__ = 'Mimesis: fake data generator.'\n__url__ = 'https://github.com/lk-geimfari/mimesis'\n__author__ = 'Isaak Uchakaev (Likid Geimfari)'\n__author_email__ = 'likid.geimfari@gmail.com'\n__license__ = 'MIT License'\n", "path": "mimesis/__init__.py"}, {"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Cryptographic data provider.\"\"\"\n\nimport hashlib\nimport secrets\nimport uuid\nfrom typing import Optional\n\nfrom mimesis.enums import Algorithm\nfrom mimesis.providers.base import BaseProvider\nfrom mimesis.providers.text import Text\n\n__all__ = ['Cryptographic']\n\n\nclass Cryptographic(BaseProvider):\n    \"\"\"Class that provides cryptographic data.\"\"\"\n\n    def __init__(self, *args, **kwargs) -> None:\n        \"\"\"Initialize attributes.\n\n        :param seed: Seed.\n        \"\"\"\n        super().__init__(*args, **kwargs)\n        self.__words = Text('en')._data.get('words', {})\n\n    class Meta:\n        \"\"\"Class for metadata.\"\"\"\n\n        name = 'cryptographic'\n\n    def uuid(self, version: int = None) -> str:\n        \"\"\"Generate random UUID.\n\n        :param version: UUID version.\n        :return: UUID\n        \"\"\"\n        bits = self.random.getrandbits(128)\n        return str(uuid.UUID(int=bits, version=version))\n\n    def hash(self, algorithm: Algorithm = None) -> str:  # noqa: A003\n        \"\"\"Generate random hash.\n\n        To change hashing algorithm, pass parameter ``algorithm``\n        with needed value of the enum object :class:`~mimesis.enums.Algorithm`\n\n        :param algorithm: Enum object :class:`~mimesis.enums.Algorithm`.\n        :return: Hash.\n        :raises NonEnumerableError: When algorithm is unsupported.\n        \"\"\"\n        key = self._validate_enum(algorithm, Algorithm)\n\n        if hasattr(hashlib, key):\n            fn = getattr(hashlib, key)\n            return fn(self.uuid().encode()).hexdigest()\n\n    @staticmethod\n    def token_bytes(entropy: int = 32) -> bytes:\n        \"\"\"Generate byte string containing ``entropy`` bytes.\n\n        The string has ``entropy`` random bytes, each byte\n        converted to two hex digits.\n\n        .. warning:: Seed is not applicable to this method,\n            because of its cryptographic-safe nature.\n\n        :param entropy: Number of bytes (default: 32).\n        :return: Random bytes.\n        \"\"\"\n        return secrets.token_bytes(entropy)\n\n    @staticmethod\n    def token_hex(entropy: int = 32) -> str:\n        \"\"\"Return a random text string, in hexadecimal.\n\n        The string has *entropy* random bytes, each byte converted to two\n        hex digits.  If *entropy* is ``None`` or not supplied, a reasonable\n        default is used.\n\n        .. warning:: Seed is not applicable to this method,\n            because of its cryptographic-safe nature.\n\n        :param entropy: Number of bytes (default: 32).\n        :return: Token.\n        \"\"\"\n        return secrets.token_hex(entropy)\n\n    @staticmethod\n    def token_urlsafe(entropy: int = 32):\n        \"\"\"Return a random URL-safe text string, in Base64 encoding.\n\n        The string has *entropy* random bytes.  If *entropy* is ``None``\n        or not supplied, a reasonable default is used.\n\n        .. warning:: Seed is not applicable to this method,\n            because of its cryptographic-safe nature.\n\n        :param entropy: Number of bytes (default: 32).\n        :return: URL-safe token.\n        \"\"\"\n        return secrets.token_urlsafe(entropy)\n\n    def mnemonic_phrase(self, length: int = 12,\n                        separator: Optional[str] = None) -> str:\n        \"\"\"Generate pseudo mnemonic phrase.\n\n        Please, keep in mind that this method generates\n        crypto-insecure values.\n\n        :param separator: Separator of phrases (Default is \" \").\n        :param length: Number of words.\n        :return: Mnemonic phrase.\n        \"\"\"\n        if not separator:\n            separator = ' '\n\n        words = self.__words['normal']\n        words_generator = (self.random.choice(words) for _ in range(length))\n        return '{}'.format(separator).join(words_generator)\n", "path": "mimesis/providers/cryptographic.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Mimesis is a Python library, which helps generate fake data.\n\nCopyright (c) 2016 - 2020 Isaak Uchakaev (Likid Geimfari)\nRepository: https://github.com/lk-geimfari/mimesis\nEmail: <likid.geimfari@gmail.com>\n\"\"\"\n\nfrom mimesis.providers import (\n    Address,\n    BaseDataProvider,\n    BaseProvider,\n    Business,\n    Choice,\n    Clothing,\n    Code,\n    Cryptographic,\n    Datetime,\n    Development,\n    File,\n    Food,\n    Generic,\n    Hardware,\n    Internet,\n    Numbers,\n    Path,\n    Payment,\n    Person,\n    Science,\n    Structure,\n    Text,\n    Transport,\n    UnitSystem,\n)\n\n__all__ = [\n    'Address',\n    'BaseDataProvider',\n    'BaseProvider',\n    'Business',\n    'Clothing',\n    'Code',\n    'Choice',\n    'Datetime',\n    'Development',\n    'File',\n    'Food',\n    'Hardware',\n    'Internet',\n    'Numbers',\n    'Path',\n    'Payment',\n    'Person',\n    'Science',\n    'Structure',\n    'Text',\n    'Transport',\n    'UnitSystem',\n    'Cryptographic',\n\n    # Has all:\n    'Generic',\n\n    # Meta:\n    '__version__',\n    '__title__',\n    '__description__',\n    '__url__',\n    '__author__',\n    '__author_email__',\n    '__license__',\n]\n\n__version__ = '4.1.0'\n__title__ = 'mimesis'\n__description__ = 'Mimesis: fake data generator.'\n__url__ = 'https://github.com/lk-geimfari/mimesis'\n__author__ = 'Isaak Uchakaev (Likid Geimfari)'\n__author_email__ = 'likid.geimfari@gmail.com'\n__license__ = 'MIT License'\n", "path": "mimesis/__init__.py"}, {"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Cryptographic data provider.\"\"\"\n\nimport hashlib\nimport secrets\nfrom typing import Optional, Union\nfrom uuid import UUID\n\nfrom mimesis.enums import Algorithm\nfrom mimesis.providers.base import BaseProvider\nfrom mimesis.providers.text import Text\n\n__all__ = ['Cryptographic']\n\n\nclass Cryptographic(BaseProvider):\n    \"\"\"Class that provides cryptographic data.\"\"\"\n\n    def __init__(self, *args, **kwargs) -> None:\n        \"\"\"Initialize attributes.\n\n        :param seed: Seed.\n        \"\"\"\n        super().__init__(*args, **kwargs)\n        self.__words = Text('en')._data.get('words', {})\n\n    class Meta:\n        \"\"\"Class for metadata.\"\"\"\n\n        name = 'cryptographic'\n\n    def uuid(self, version: int = None,\n             as_object: bool = False) -> Union[UUID, str]:\n        \"\"\"Generate random UUID.\n\n        This method returns string by default,\n        but yoy can make it return uuid.UUID object using\n        parameter **as_object**\n\n        :param as_object: Returns uuid.UUID object instead of string.\n        :param version: UUID version.\n        :return: UUID.\n        \"\"\"\n        bits = self.random.getrandbits(128)\n        uuid_obj = UUID(int=bits, version=version)\n\n        if not as_object:\n            return str(uuid_obj)\n\n        return uuid_obj\n\n    def hash(self, algorithm: Algorithm = None) -> str:  # noqa: A003\n        \"\"\"Generate random hash.\n\n        To change hashing algorithm, pass parameter ``algorithm``\n        with needed value of the enum object :class:`~mimesis.enums.Algorithm`\n\n        :param algorithm: Enum object :class:`~mimesis.enums.Algorithm`.\n        :return: Hash.\n        :raises NonEnumerableError: When algorithm is unsupported.\n        \"\"\"\n        key = self._validate_enum(algorithm, Algorithm)\n\n        if hasattr(hashlib, key):\n            fn = getattr(hashlib, key)\n            return fn(self.uuid().encode()).hexdigest()\n\n    @staticmethod\n    def token_bytes(entropy: int = 32) -> bytes:\n        \"\"\"Generate byte string containing ``entropy`` bytes.\n\n        The string has ``entropy`` random bytes, each byte\n        converted to two hex digits.\n\n        .. warning:: Seed is not applicable to this method,\n            because of its cryptographic-safe nature.\n\n        :param entropy: Number of bytes (default: 32).\n        :return: Random bytes.\n        \"\"\"\n        return secrets.token_bytes(entropy)\n\n    @staticmethod\n    def token_hex(entropy: int = 32) -> str:\n        \"\"\"Return a random text string, in hexadecimal.\n\n        The string has *entropy* random bytes, each byte converted to two\n        hex digits.  If *entropy* is ``None`` or not supplied, a reasonable\n        default is used.\n\n        .. warning:: Seed is not applicable to this method,\n            because of its cryptographic-safe nature.\n\n        :param entropy: Number of bytes (default: 32).\n        :return: Token.\n        \"\"\"\n        return secrets.token_hex(entropy)\n\n    @staticmethod\n    def token_urlsafe(entropy: int = 32):\n        \"\"\"Return a random URL-safe text string, in Base64 encoding.\n\n        The string has *entropy* random bytes.  If *entropy* is ``None``\n        or not supplied, a reasonable default is used.\n\n        .. warning:: Seed is not applicable to this method,\n            because of its cryptographic-safe nature.\n\n        :param entropy: Number of bytes (default: 32).\n        :return: URL-safe token.\n        \"\"\"\n        return secrets.token_urlsafe(entropy)\n\n    def mnemonic_phrase(self, length: int = 12,\n                        separator: Optional[str] = None) -> str:\n        \"\"\"Generate pseudo mnemonic phrase.\n\n        Please, keep in mind that this method generates\n        crypto-insecure values.\n\n        :param separator: Separator of phrases (Default is \" \").\n        :param length: Number of words.\n        :return: Mnemonic phrase.\n        \"\"\"\n        if not separator:\n            separator = ' '\n\n        words = self.__words['normal']\n        words_generator = (self.random.choice(words) for _ in range(length))\n        return '{}'.format(separator).join(words_generator)\n", "path": "mimesis/providers/cryptographic.py"}]}