Repository: lk-geimfari/mimesis

Issue:
Change how works generating data by schema
The current design is bad for following reasons:

`Field` is an object which can represent any method of any provider and it's mean that is data provider which should return data and it's the only thing that we want by this object, but here how it works right now:

```
>>> from mimesis.schema import Field
>>> from mimesis.enums import Gender
_ = Field('en')
>>> _ = Field('en')
>>> app_schema = (
...     lambda: {
...         "id": _('uuid'),
...         "name": _('word'),
...         "version": _('version'),
...         "owner": {
...             "email": _('email'),
...             "token": _('token'),
...             "creator": _('full_name', gender=Gender.FEMALE),
...         },
...     }
... )
>>> _.fill(schema=app_schema, iterations=10)
```

It looks really annoying.

It should be done using another way because here every instance of `Field` contains method `fill`, but why? Good question... because this is disgusting API designed by me. And now I see my mistake and suggest that it be corrected.

I suggest this:

```
from mimesis.schema import Field, Schema
_ = Field('en')
app_data = Schema(lambda: {
    "id": _('uuid'),
    "name": _('word'),
    "version": _('version'),
    "owner": {
        "email": _('email'),
        "token": _('token'),
        "creator": _('full_name', gender=Gender.FEMALE),
    },
}).create(iterations=20)
```

I think that is much better because the code is much more readable and looks more logical.


Discussion:

Resolving patch:
diff --git a/mimesis/providers/development.py b/mimesis/providers/development.py
--- a/mimesis/providers/development.py
+++ b/mimesis/providers/development.py
@@ -16,16 +16,28 @@ def software_license(self) -> str:
         """
         return self.random.choice(LICENSES)
 
-    def version(self, pre_release: bool = False) -> str:
+    def version(self, calver: bool = False, pre_release: bool = False) -> str:
         """Generate a random version information.
 
+        :param calver: Use calendar versioning.
         :param pre_release: Pre-release.
         :return: The version of software.
-
+.
         :Example:
             0.11.3-alpha.1
         """
+        version = '{}.{}.{}'
         major, minor, patch = self.random.randints(3, 0, 10)
+
+        if calver:
+            if minor == 0:
+                minor += 1
+
+            if patch == 0:
+                patch += 1
+            major = self.random.randint(2016, 2018)
+            return version.format(major, minor, patch)
+
         version = '{}.{}.{}'.format(major, minor, patch)
 
         if pre_release:


Test patch:
diff --git a/tests/test_data/test_development.py b/tests/test_data/test_development.py
--- a/tests/test_data/test_development.py
+++ b/tests/test_data/test_development.py
@@ -23,23 +23,27 @@ def test_version_control_system(dev):
 def test_version(dev):
     result = dev.version().split('.')
 
+    result = [int(i) for i in result]
+
     assert len(result) == 3
 
-    major = int(result[0])
-    assert major >= 0
-    assert major <= 11
+    major = result[0]
+    assert (major >= 0) and (major <= 11)
 
-    minor = int(result[1])
-    assert minor >= 0
-    assert minor <= 11
+    minor = result[1]
+    assert (minor >= 0) and (minor <= 11)
 
-    patch = int(result[2])
-    assert patch >= 0
-    assert patch <= 11
+    patch = result[2]
+    assert (patch >= 0) and (patch <= 11)
 
     pre_release = dev.version(pre_release=True)
     assert len(pre_release.split('.')) == 4
 
+    # Use calendar versioning
+    calver = dev.version(calver=True)
+    y, *_ = calver.split('.')
+    assert (int(y) >= 2016) and (int(y) <= 2018)
+
 
 def test_programming_language(dev):
     result = dev.programming_language()