Repository: lk-geimfari/mimesis

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


Discussion:
I've noticed this behavior too. I think this happens since one of the last releases of `mypy`. We can use `Callable`.
If you have free time then you can create a PR, of course.

Resolving patch:
diff --git a/mimesis/schema.py b/mimesis/schema.py
--- a/mimesis/schema.py
+++ b/mimesis/schema.py
@@ -11,7 +11,7 @@
     UnsupportedField,
 )
 from mimesis.providers.generic import Generic
-from mimesis.typing import JSON, Seed
+from mimesis.typing import JSON, SchemaType, Seed
 
 __all__ = ['Field', 'Schema']
 
@@ -118,10 +118,10 @@ def __str__(self):
 class Schema:
     """Class which return list of filled schemas."""
 
-    def __init__(self, schema: Callable) -> None:
+    def __init__(self, schema: SchemaType) -> None:
         """Initialize schema.
 
-        :param schema: A schema.
+        :param schema: A schema (must be a callable object).
         """
         if callable(schema):
             self.schema = schema
diff --git a/mimesis/typing.py b/mimesis/typing.py
--- a/mimesis/typing.py
+++ b/mimesis/typing.py
@@ -3,7 +3,7 @@
 """Custom types and shortcuts for annotating Mimesis."""
 
 import datetime
-from typing import Any, Dict, Union
+from typing import Any, Callable, Dict, Union
 
 __all__ = [
     'JSON',
@@ -11,6 +11,7 @@
     'Timestamp',
     'Time',
     'Date',
+    'SchemaType',
     'Seed',
 ]
 
@@ -25,3 +26,5 @@
 Timestamp = Union[str, int]
 
 Seed = Union[int, str, bytes, bytearray]
+
+SchemaType = Callable[[], JSON]


Test patch:
diff --git a/tests/test_schema.py b/tests/test_schema.py
--- a/tests/test_schema.py
+++ b/tests/test_schema.py
@@ -93,9 +93,10 @@ def test_fill(field, valid_schema):
     assert isinstance(result[0], dict)
 
 
-def test_none_schema(field):
+def test_none_schema():
     with pytest.raises(UndefinedSchema):
-        Schema(schema=None).create()  # type: ignore
+        schema = Schema(schema=None)  # type: ignore
+        schema.create()
 
 
 def test_schema_with_unacceptable_field(field):
@@ -110,7 +111,7 @@ def test_schema_with_unacceptable_field(field):
     })
 
     with pytest.raises(UnacceptableField):
-        Schema(schema=invalid_schema).create()  # type: ignore
+        Schema(schema=invalid_schema).create()
 
 
 def test_field_with_key(field):