prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  PyCharm indicates wrong type for lambda
  # Bug report
  
  <!--
  Hi, thanks for submitting a bug. We appreciate that.
  
  But, we will need some information about what's wrong to help you.
  -->
  
  ## What's wrong
  
  While using PyCharm,  `lambda` type in `Schema` results in *Expected type 'FunctionType', got '() -> Dict[str, Union[str, Any]]' instead*
  ![Screenshot 2020-08-28 at 07 59 37](https://user-images.githubusercontent.com/55017335/91531501-ca378a80-e904-11ea-9558-5b44bcff7040.png)
  
  <!-- Describe what is not working. Please, attach a traceback. -->
  
  ## How is that should be
  Is this warning correct? The code runs perfectly fine but maybe the Type maybe be wrong here. On this [SO post](https://stackoverflow.com/a/33833896/12794150) they mentioned using the `from typing import Callable` for type hinting a lambda.
  <!-- Describe how it should work. -->
  
  ## System information
  
  <!-- Describe system information -->
  ```
  ❯ python3 --version
  Python 3.8.5
  
  ❯ sw_vers
  ProductName:	macOS
  ProductVersion:	11.0
  BuildVersion:	20A5354i
  ```
  PyCharm 2020.2.1
  
  --- 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/schema.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 
  3 """Implements classes for generating data by schema."""
  4 
  5 from types import LambdaType
  6 from typing import Any, Callable, List, Optional
  7 
  8 from mimesis.exceptions import (
  9     UnacceptableField,
  10     UndefinedField,
  11     UndefinedSchema,
  12     UnsupportedField,
  13 )
  14 from mimesis.providers.generic import Generic
  15 from mimesis.typing import JSON, Seed
  16 
  17 __all__ = ['Field', 'Schema']
  18 
  19 
  20 class AbstractField(object):
  21     """
  22     AbstractField is a class for generating data by the name of the method.
  23 
  24     Instance of this object takes any string which represents name
  25     of any method of any supported data provider (:class:`~mimesis.Generic`)
  26     and the ``**kwargs`` of the method.
  27 
  28     See :class:`~mimesis.schema.AbstractField.__call__` for more details.
  29     """
  30 
  31     def __init__(self, locale: str = 'en',
  32                  seed: Optional[Seed] = None,
  33                  providers: Optional[Any] = None) -> None:
  34         """Initialize field.
  35 
  36         :param locale: Locale
  37         :param seed: Seed for random.
  38         """
  39         self.locale = locale
  40         self.seed = seed
  41         self._gen = Generic(self.locale, self.seed)
  42 
  43         if providers:
  44             self._gen.add_providers(*providers)
  45 
  46         self._table = {}  # type: ignore
  47 
  48     def __call__(self, name: Optional[str] = None,
  49                  key: Optional[Callable] = None, **kwargs) -> Any:
  50         """Override standard call.
  51 
  52         This magic method overrides standard call so it takes any string
  53         which represents the name of any method of any supported data
  54         provider and the ``**kwargs`` of this method.
  55 
  56         .. note:: Some data providers have methods with the same names
  57             and in such cases, you can explicitly define that the method
  58             belongs to data-provider ``name='provider.name'`` otherwise
  59             it will return the data from the first provider which
  60             has a method ``name``.
  61 
  62         You can apply a *key function* to the result returned by
  63         the method, bt passing a parameter **key** with a callable
  64         object which returns the final result.
  65 
  66         :param name: Name of the method.
  67         :param key: A key function (or other callable object)
  68             which will be applied to result.
  69         :param kwargs: Kwargs of method.
  70         :return: Value which represented by method.
  71         :raises ValueError: if provider not
  72             supported or if field not defined.
  73         """
  74         if name is None:
  75             raise UndefinedField()
  76 
  77         def tail_parser(tails: str, obj: Any) -> Any:
  78             """Return method from end of tail.
  79 
  80             :param tails: Tail string
  81             :param obj: Search tail from this object
  82             :return last tailed method
  83             """
  84             provider_name, method_name = tails.split('.', 1)
  85 
  86             if '.' in method_name:
  87                 raise UnacceptableField()
  88 
  89             attr = getattr(obj, provider_name)
  90             if attr is not None:
  91                 return getattr(attr, method_name)
  92 
  93         try:
  94             if name not in self._table:
  95                 if '.' not in name:
  96                     # Fix https://github.com/lk-geimfari/mimesis/issues/619
  97                     if name == self._gen.choice.Meta.name:
  98                         self._table[name] = self._gen.choice
  99                     else:
  100                         for provider in dir(self._gen):
  101                             provider = getattr(self._gen, provider)
  102                             if name in dir(provider):
  103                                 self._table[name] = getattr(provider, name)
  104                 else:
  105                     self._table[name] = tail_parser(name, self._gen)
  106 
  107             result = self._table[name](**kwargs)
  108             if key and callable(key):
  109                 return key(result)
  110             return result
  111         except KeyError:
  112             raise UnsupportedField(name)
  113 
  114     def __str__(self):
  115         return '{} <{}>'.format(
  116             self.__class__.__name__, self.locale)
  117 
  118 
  119 class Schema(object):
  120     """Class which return list of filled schemas."""
  121 
  122     def __init__(self, schema: LambdaType) -> None:
  123         """Initialize schema.
  124 
  125         :param schema: A schema.
  126         """
  127         if isinstance(schema, LambdaType):
  128             self.schema = schema
  129         else:
  130             raise UndefinedSchema()
  131 
  132     def create(self, iterations: int = 1) -> List[JSON]:
  133         """Return filled schema.
  134 
  135         Create a list of a filled schemas with elements in
  136         an amount of **iterations**.
  137 
  138         :param iterations: Amount of iterations.
  139         :return: List of willed schemas.
  140         """
  141         return [self.schema() for _ in range(iterations)]
  142 
  143 
  144 # Alias for AbstractField
  145 Field = AbstractField
  146
  ```
  --- 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/schema.py b/mimesis/schema.py
  --- a/mimesis/schema.py
  +++ b/mimesis/schema.py
  @@ -2,7 +2,6 @@
   
   """Implements classes for generating data by schema."""
   
  -from types import LambdaType
   from typing import Any, Callable, List, Optional
   
   from mimesis.exceptions import (
  @@ -17,7 +16,7 @@
   __all__ = ['Field', 'Schema']
   
   
  -class AbstractField(object):
  +class AbstractField:
       """
       AbstractField is a class for generating data by the name of the method.
   
  @@ -116,15 +115,15 @@
               self.__class__.__name__, self.locale)
   
   
  -class Schema(object):
  +class Schema:
       """Class which return list of filled schemas."""
   
  -    def __init__(self, schema: LambdaType) -> None:
  +    def __init__(self, schema: Callable) -> None:
           """Initialize schema.
   
           :param schema: A schema.
           """
  -        if isinstance(schema, LambdaType):
  +        if callable(schema):
               self.schema = schema
           else:
               raise UndefinedSchema()
  
verification_info: {"golden_diff": "diff --git a/mimesis/schema.py b/mimesis/schema.py\n--- a/mimesis/schema.py\n+++ b/mimesis/schema.py\n@@ -2,7 +2,6 @@\n \n \"\"\"Implements classes for generating data by schema.\"\"\"\n \n-from types import LambdaType\n from typing import Any, Callable, List, Optional\n \n from mimesis.exceptions import (\n@@ -17,7 +16,7 @@\n __all__ = ['Field', 'Schema']\n \n \n-class AbstractField(object):\n+class AbstractField:\n     \"\"\"\n     AbstractField is a class for generating data by the name of the method.\n \n@@ -116,15 +115,15 @@\n             self.__class__.__name__, self.locale)\n \n \n-class Schema(object):\n+class Schema:\n     \"\"\"Class which return list of filled schemas.\"\"\"\n \n-    def __init__(self, schema: LambdaType) -> None:\n+    def __init__(self, schema: Callable) -> None:\n         \"\"\"Initialize schema.\n \n         :param schema: A schema.\n         \"\"\"\n-        if isinstance(schema, LambdaType):\n+        if callable(schema):\n             self.schema = schema\n         else:\n             raise UndefinedSchema()\n", "issue": "PyCharm indicates wrong type for lambda\n# Bug report\r\n\r\n<!--\r\nHi, thanks for submitting a bug. We appreciate that.\r\n\r\nBut, we will need some information about what's wrong to help you.\r\n-->\r\n\r\n## What's wrong\r\n\r\nWhile using PyCharm,  `lambda` type in `Schema` results in *Expected type 'FunctionType', got '() -> Dict[str, Union[str, Any]]' instead*\r\n![Screenshot 2020-08-28 at 07 59 37](https://user-images.githubusercontent.com/55017335/91531501-ca378a80-e904-11ea-9558-5b44bcff7040.png)\r\n\r\n<!-- Describe what is not working. Please, attach a traceback. -->\r\n\r\n## How is that should be\r\nIs this warning correct? The code runs perfectly fine but maybe the Type maybe be wrong here. On this [SO post](https://stackoverflow.com/a/33833896/12794150) they mentioned using the `from typing import Callable` for type hinting a lambda.\r\n<!-- Describe how it should work. -->\r\n\r\n## System information\r\n\r\n<!-- Describe system information -->\r\n```\r\n\u276f python3 --version\r\nPython 3.8.5\r\n\r\n\u276f sw_vers\r\nProductName:\tmacOS\r\nProductVersion:\t11.0\r\nBuildVersion:\t20A5354i\r\n```\r\nPyCharm 2020.2.1\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Implements classes for generating data by schema.\"\"\"\n\nfrom types import LambdaType\nfrom typing import Any, Callable, List, Optional\n\nfrom mimesis.exceptions import (\n    UnacceptableField,\n    UndefinedField,\n    UndefinedSchema,\n    UnsupportedField,\n)\nfrom mimesis.providers.generic import Generic\nfrom mimesis.typing import JSON, Seed\n\n__all__ = ['Field', 'Schema']\n\n\nclass AbstractField(object):\n    \"\"\"\n    AbstractField is a class for generating data by the name of the method.\n\n    Instance of this object takes any string which represents name\n    of any method of any supported data provider (:class:`~mimesis.Generic`)\n    and the ``**kwargs`` of the method.\n\n    See :class:`~mimesis.schema.AbstractField.__call__` for more details.\n    \"\"\"\n\n    def __init__(self, locale: str = 'en',\n                 seed: Optional[Seed] = None,\n                 providers: Optional[Any] = None) -> None:\n        \"\"\"Initialize field.\n\n        :param locale: Locale\n        :param seed: Seed for random.\n        \"\"\"\n        self.locale = locale\n        self.seed = seed\n        self._gen = Generic(self.locale, self.seed)\n\n        if providers:\n            self._gen.add_providers(*providers)\n\n        self._table = {}  # type: ignore\n\n    def __call__(self, name: Optional[str] = None,\n                 key: Optional[Callable] = None, **kwargs) -> Any:\n        \"\"\"Override standard call.\n\n        This magic method overrides standard call so it takes any string\n        which represents the name of any method of any supported data\n        provider and the ``**kwargs`` of this method.\n\n        .. note:: Some data providers have methods with the same names\n            and in such cases, you can explicitly define that the method\n            belongs to data-provider ``name='provider.name'`` otherwise\n            it will return the data from the first provider which\n            has a method ``name``.\n\n        You can apply a *key function* to the result returned by\n        the method, bt passing a parameter **key** with a callable\n        object which returns the final result.\n\n        :param name: Name of the method.\n        :param key: A key function (or other callable object)\n            which will be applied to result.\n        :param kwargs: Kwargs of method.\n        :return: Value which represented by method.\n        :raises ValueError: if provider not\n            supported or if field not defined.\n        \"\"\"\n        if name is None:\n            raise UndefinedField()\n\n        def tail_parser(tails: str, obj: Any) -> Any:\n            \"\"\"Return method from end of tail.\n\n            :param tails: Tail string\n            :param obj: Search tail from this object\n            :return last tailed method\n            \"\"\"\n            provider_name, method_name = tails.split('.', 1)\n\n            if '.' in method_name:\n                raise UnacceptableField()\n\n            attr = getattr(obj, provider_name)\n            if attr is not None:\n                return getattr(attr, method_name)\n\n        try:\n            if name not in self._table:\n                if '.' not in name:\n                    # Fix https://github.com/lk-geimfari/mimesis/issues/619\n                    if name == self._gen.choice.Meta.name:\n                        self._table[name] = self._gen.choice\n                    else:\n                        for provider in dir(self._gen):\n                            provider = getattr(self._gen, provider)\n                            if name in dir(provider):\n                                self._table[name] = getattr(provider, name)\n                else:\n                    self._table[name] = tail_parser(name, self._gen)\n\n            result = self._table[name](**kwargs)\n            if key and callable(key):\n                return key(result)\n            return result\n        except KeyError:\n            raise UnsupportedField(name)\n\n    def __str__(self):\n        return '{} <{}>'.format(\n            self.__class__.__name__, self.locale)\n\n\nclass Schema(object):\n    \"\"\"Class which return list of filled schemas.\"\"\"\n\n    def __init__(self, schema: LambdaType) -> None:\n        \"\"\"Initialize schema.\n\n        :param schema: A schema.\n        \"\"\"\n        if isinstance(schema, LambdaType):\n            self.schema = schema\n        else:\n            raise UndefinedSchema()\n\n    def create(self, iterations: int = 1) -> List[JSON]:\n        \"\"\"Return filled schema.\n\n        Create a list of a filled schemas with elements in\n        an amount of **iterations**.\n\n        :param iterations: Amount of iterations.\n        :return: List of willed schemas.\n        \"\"\"\n        return [self.schema() for _ in range(iterations)]\n\n\n# Alias for AbstractField\nField = AbstractField\n", "path": "mimesis/schema.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Implements classes for generating data by schema.\"\"\"\n\nfrom typing import Any, Callable, List, Optional\n\nfrom mimesis.exceptions import (\n    UnacceptableField,\n    UndefinedField,\n    UndefinedSchema,\n    UnsupportedField,\n)\nfrom mimesis.providers.generic import Generic\nfrom mimesis.typing import JSON, Seed\n\n__all__ = ['Field', 'Schema']\n\n\nclass AbstractField:\n    \"\"\"\n    AbstractField is a class for generating data by the name of the method.\n\n    Instance of this object takes any string which represents name\n    of any method of any supported data provider (:class:`~mimesis.Generic`)\n    and the ``**kwargs`` of the method.\n\n    See :class:`~mimesis.schema.AbstractField.__call__` for more details.\n    \"\"\"\n\n    def __init__(self, locale: str = 'en',\n                 seed: Optional[Seed] = None,\n                 providers: Optional[Any] = None) -> None:\n        \"\"\"Initialize field.\n\n        :param locale: Locale\n        :param seed: Seed for random.\n        \"\"\"\n        self.locale = locale\n        self.seed = seed\n        self._gen = Generic(self.locale, self.seed)\n\n        if providers:\n            self._gen.add_providers(*providers)\n\n        self._table = {}  # type: ignore\n\n    def __call__(self, name: Optional[str] = None,\n                 key: Optional[Callable] = None, **kwargs) -> Any:\n        \"\"\"Override standard call.\n\n        This magic method overrides standard call so it takes any string\n        which represents the name of any method of any supported data\n        provider and the ``**kwargs`` of this method.\n\n        .. note:: Some data providers have methods with the same names\n            and in such cases, you can explicitly define that the method\n            belongs to data-provider ``name='provider.name'`` otherwise\n            it will return the data from the first provider which\n            has a method ``name``.\n\n        You can apply a *key function* to the result returned by\n        the method, bt passing a parameter **key** with a callable\n        object which returns the final result.\n\n        :param name: Name of the method.\n        :param key: A key function (or other callable object)\n            which will be applied to result.\n        :param kwargs: Kwargs of method.\n        :return: Value which represented by method.\n        :raises ValueError: if provider not\n            supported or if field not defined.\n        \"\"\"\n        if name is None:\n            raise UndefinedField()\n\n        def tail_parser(tails: str, obj: Any) -> Any:\n            \"\"\"Return method from end of tail.\n\n            :param tails: Tail string\n            :param obj: Search tail from this object\n            :return last tailed method\n            \"\"\"\n            provider_name, method_name = tails.split('.', 1)\n\n            if '.' in method_name:\n                raise UnacceptableField()\n\n            attr = getattr(obj, provider_name)\n            if attr is not None:\n                return getattr(attr, method_name)\n\n        try:\n            if name not in self._table:\n                if '.' not in name:\n                    # Fix https://github.com/lk-geimfari/mimesis/issues/619\n                    if name == self._gen.choice.Meta.name:\n                        self._table[name] = self._gen.choice\n                    else:\n                        for provider in dir(self._gen):\n                            provider = getattr(self._gen, provider)\n                            if name in dir(provider):\n                                self._table[name] = getattr(provider, name)\n                else:\n                    self._table[name] = tail_parser(name, self._gen)\n\n            result = self._table[name](**kwargs)\n            if key and callable(key):\n                return key(result)\n            return result\n        except KeyError:\n            raise UnsupportedField(name)\n\n    def __str__(self):\n        return '{} <{}>'.format(\n            self.__class__.__name__, self.locale)\n\n\nclass Schema:\n    \"\"\"Class which return list of filled schemas.\"\"\"\n\n    def __init__(self, schema: Callable) -> None:\n        \"\"\"Initialize schema.\n\n        :param schema: A schema.\n        \"\"\"\n        if callable(schema):\n            self.schema = schema\n        else:\n            raise UndefinedSchema()\n\n    def create(self, iterations: int = 1) -> List[JSON]:\n        \"\"\"Return filled schema.\n\n        Create a list of a filled schemas with elements in\n        an amount of **iterations**.\n\n        :param iterations: Amount of iterations.\n        :return: List of willed schemas.\n        \"\"\"\n        return [self.schema() for _ in range(iterations)]\n\n\n# Alias for AbstractField\nField = AbstractField\n", "path": "mimesis/schema.py"}]}