Skip to content

Commit

Permalink
Fixed #399 (#400)
Browse files Browse the repository at this point in the history
* Renamed Personal to Person
* Renamed ClothingSizes to ClothingSize
* Renamed Structured to Structure
  • Loading branch information
lk-geimfari committed Feb 2, 2018
1 parent 6b1d722 commit f92785f
Show file tree
Hide file tree
Showing 90 changed files with 407 additions and 341 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Expand Up @@ -11,8 +11,13 @@
- Significantly improved performance of `schema.Field`
- Other minor improvements

**Updated**:
**Updated/Renamed**:
- Updated method `integers`
- Renamed provider `Personal` to `Person`
- Renamed provider `Structured` to `Structure`
- Renamed provider `ClothingSizes` to `ClothingSize`
- Renamed json file `personal.json` to `person.json` for all locales


---

Expand Down
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -42,8 +42,8 @@ Complete documentation is available on [Read the Docs](http://mimesis.readthedoc
That's library is really easy to use and a simple usage example is given below:

```python
>>> from mimesis import Personal
>>> person = Personal('en')
>>> from mimesis import Person
>>> person = Person('en')

>>> person.full_name()
'Antonetta Garrison'
Expand All @@ -56,11 +56,11 @@ That's library is really easy to use and a simple usage example is given below:
Mimesis currently includes support for 33 different [locales](http://mimesis.readthedocs.io/quickstart.html#supported-locales). You can specify a locale when creating providers and they will return data that is appropriate for the language or country associated with that locale:

```python
>>> from mimesis import Personal
>>> from mimesis import Person
>>> from mimesis.enums import Gender

>>> de = Personal('de')
>>> pl = Personal('pl')
>>> de = Person('de')
>>> pl = Person('pl')

>>> de.full_name(gender=Gender.FEMALE)
'Sabrina Gutermuth'
Expand Down
@@ -1,6 +1,6 @@
import pytest

from mimesis.providers import ClothingSizes as Provider
from mimesis.providers import ClothingSize as Provider


@pytest.fixture
Expand Down
@@ -1,6 +1,6 @@
import pytest

from mimesis.providers import Personal as Provider
from mimesis.providers import Person as Provider


@pytest.fixture
Expand Down
@@ -1,6 +1,6 @@
import pytest

from mimesis.providers import Structured as Provider
from mimesis.providers import Structure as Provider


@pytest.fixture
Expand Down
28 changes: 15 additions & 13 deletions docs/advanced.rst
Expand Up @@ -17,25 +17,26 @@ listed in the end of the article and find out more. The library is
pretty simple. All you need to do to start working with the data is to
create a class provider. The most common type of data in apps are
personal users’ data, such as name, last name, credit card info, etc.
There is a special class provider for this type of data — :class:`~mimesis.Personal()`,
There is a special class provider for this type of data — :class:`~mimesis.Person()`,
which takes the code from the language standard in the form of a line as
shown below:

.. code:: python
>>> from mimesis import Personal
>>> from mimesis import Person
>>> from mimesis.enums import Gender
>>> person = Personal('is')
>>> person = Person('is')
>>> for _ in range(0, 3):
... person.full_name(gender=Gender.MALE)
...
'Karl Brynjúlfsson'
'Rögnvald Eiðsson'
'Vésteinn Ríkharðsson'
Almost every web-application requires e-mail for registration.
Naturally, the library supports the ability to generate e-mails with the
help of :meth:`~mimesis.Personal.email()` method :class:`~mimesis.Personal()` class, as below:
help of :meth:`~mimesis.Person.email()` method :class:`~mimesis.Person()` class, as below:

.. code:: python
Expand All @@ -51,7 +52,7 @@ which grants access to all providers from one single object:
>>> from mimesis import Generic
>>> g = Generic('pl')
>>> g.personal.full_name()
>>> g.person.full_name()
'Lonisława Podsiadło'
>>> g.datetime.birthday(readable=True)
'Listopad 11, 1997'
Expand Down Expand Up @@ -151,21 +152,22 @@ Incorrect:

.. code:: python
>>> from mimesis import Personal, Datetime, Text, Code
>>> from mimesis import Person, Datetime, Text, Code
>>> personal = Personal('ru')
>>> person = Person('ru')
>>> datetime = Datetime('ru')
>>> text = Text('ru')
>>> code = Code('ru')
Correct:

.. code:: python
>>> from mimesis import Generic
>>> generic = Generic('ru')
>>> generic.personal.username()
>>> generic.person.username()
'sherley3354'
>>> generic.datetime.date()
Expand All @@ -175,10 +177,10 @@ Still correct:

.. code:: python
>>> from mimesis import Personal
>>> from mimesis import Person
>>> p_en = Personal('en')
>>> p_sv = Personal('sv')
>>> p_en = Person('en')
>>> p_sv = Person('sv')
>>> #
It means that importing class providers separately makes sense only if
Expand Down Expand Up @@ -230,8 +232,8 @@ for Flask (Flask-SQLAlchemy) would look like this:
@staticmethod
def _bootstrap(count=500, locale='en'):
from mimesis import Personal
person = Personal(locale)
from mimesis import Person
person = Person(locale)
for _ in range(count):
patient = Patient(
Expand Down
12 changes: 6 additions & 6 deletions docs/api.rst
Expand Up @@ -129,10 +129,10 @@ Business
:members:
:special-members: __init__

ClothingSizes
ClothingSize
-------------

.. autoclass:: mimesis.ClothingSizes
.. autoclass:: mimesis.ClothingSize
:members:
:special-members: __init__

Expand Down Expand Up @@ -220,10 +220,10 @@ Path
:members:
:special-members: __init__

Personal
Person
--------

.. autoclass:: mimesis.Personal
.. autoclass:: mimesis.Person
:members:
:special-members: __init__

Expand All @@ -234,10 +234,10 @@ Science
:members:
:special-members: __init__

Structured
Structure
----------

.. autoclass:: mimesis.Structured
.. autoclass:: mimesis.Structure
:members:
:special-members: __init__

Expand Down
12 changes: 6 additions & 6 deletions docs/foreword.rst
Expand Up @@ -24,10 +24,10 @@ Importing needing classes and creating instances:
import cProfile
from mimesis import Personal
from mimesis import Person
from faker import Faker
personal = Personal()
person = Person()
faker = Faker()
Expand All @@ -37,7 +37,7 @@ Generate 10k full names
.. code:: python
# Generating using Mimesis:
cProfile.run('[personal.full_name() for _ in range(10000)]')
cProfile.run('[person.full_name() for _ in range(10000)]')
# Generating using Faker:
cProfile.run('[faker.name() for _ in range(10000)]')
Expand All @@ -47,7 +47,7 @@ Result:
+----------+----------------------------------------+---------------------+------------------------+
| Library | Method name | Iterations | Runtime (second) |
+==========+========================================+=====================+========================+
| Mimesis | :meth:`~mimesis.Personal.full_name` | 10 000 | 0.254 |
| Mimesis | :meth:`~mimesis.Person.full_name` | 10 000 | 0.254 |
+----------+----------------------------------------+---------------------+------------------------+
| Faker | **Faker.name()** | 10 000 | 15.144 |
+----------+----------------------------------------+---------------------+------------------------+
Expand All @@ -58,7 +58,7 @@ Generate 10k last names
.. code:: python
# Generating using Mimesis:
cProfile.run('[personal.last_name() for _ in range(10000)]')
cProfile.run('[person.last_name() for _ in range(10000)]')
# Generating using Faker:
cProfile.run('[faker.last_name() for _ in range(10000)]')
Expand All @@ -69,7 +69,7 @@ Result:
+----------+----------------------------------------+---------------------+------------------------+
| Library | Method name | Iterations | Runtime (second) |
+==========+========================================+=====================+========================+
| Mimesis | :meth:`~mimesis.Personal.last_name` | 10 000 | 0.040 |
| Mimesis | :meth:`~mimesis.Person.last_name` | 10 000 | 0.040 |
+----------+----------------------------------------+---------------------+------------------------+
| Faker | **Faker.last_name()** | 10 000 | 8.218 |
+----------+----------------------------------------+---------------------+------------------------+
Expand Down
27 changes: 14 additions & 13 deletions docs/quickstart.rst
Expand Up @@ -15,22 +15,23 @@ A minimal usage example:

.. code:: python
>>> from mimesis import Personal
>>> from mimesis import Person
>>> from mimesis.enums import Gender
>>> person = Personal('en')
>>> person = Person('en')
>>> person.full_name(gender=Gender.FEMALE)
'Antonetta Garrison'
>>> person.full_name(gender=Gender.MALE)
'Jordon Hall'
So what did the code above?

1. First we imported the :class:`~mimesis.Personal` class. An instance of this
1. First we imported the :class:`~mimesis.Person` class. An instance of this
class will be our provider of personal data.
2. We import object :class:`~mimesis.enums.Gender` which we are used as a
parameter for the :meth:`~mimesis.Personal.full_name`.
parameter for the :meth:`~mimesis.Person.full_name`.
3. Next we generate random female full name for locale **en**.
4. The same as above, but for male.

Expand All @@ -43,10 +44,10 @@ to data provider:

.. code-block:: python
>>> from mimesis import Personal
>>> from mimesis import Person
>>> personal = Personal('tr', seed=0xFF)
>>> personal.full_name()
>>> person = Person('tr', seed=0xFF)
>>> person.full_name()
'Gizem Tekand'
Expand Down Expand Up @@ -143,7 +144,7 @@ Usual Providers
+------+----------------------------------+------------------------------------------------------------------+
| 3 | :class:`~mimesis.Code` | Codes (ISBN, EAN, IMEI etc.). |
+------+----------------------------------+------------------------------------------------------------------+
| 4 | :class:`~mimesis.ClothingSizes` | Clothing sizes (international sizes, european etc.) |
| 4 | :class:`~mimesis.ClothingSize` | Clothing sizes (international sizes, european etc.) |
+------+----------------------------------+------------------------------------------------------------------+
| 5 | :class:`~mimesis.Datetime` | Datetime (day of week, month, year etc.) |
+------+----------------------------------+------------------------------------------------------------------+
Expand All @@ -155,15 +156,15 @@ Usual Providers
+------+----------------------------------+------------------------------------------------------------------+
| 9 | :class:`~mimesis.Games` | Games data (game, score, pegi\_rating etc.) |
+------+----------------------------------+------------------------------------------------------------------+
| 10 | :class:`~mimesis.Personal` | Personal data (name, surname, age, email etc.) |
| 10 | :class:`~mimesis.Person` | Personal data (name, surname, age, email etc.) |
+------+----------------------------------+------------------------------------------------------------------+
| 11 | :class:`~mimesis.Text` | Text data (sentence, title etc.) |
+------+----------------------------------+------------------------------------------------------------------+
| 12 | :class:`~mimesis.Transport` | Dummy data about transport (truck model, car etc.) |
+------+----------------------------------+------------------------------------------------------------------+
| 13 | :class:`~mimesis.Science` | Scientific data (rna sequence dna sequence, etc.) |
+------+----------------------------------+------------------------------------------------------------------+
| 14 | :class:`~mimesis.Structured` | Structured data (html, css etc.) |
| 14 | :class:`~mimesis.Structure` | Structured data (html, css etc.) |
+------+----------------------------------+------------------------------------------------------------------+
| 15 | :class:`~mimesis.Internet` | Internet data (facebook, twitter etc.) |
+------+----------------------------------+------------------------------------------------------------------+
Expand Down Expand Up @@ -306,8 +307,8 @@ won’t run):

.. code:: python
>>> from mimesis import Personal
>>> person = Personal('en')
>>> from mimesis import Person
>>> person = Person('en')
>>> person.ssn()
>>> person.cpf()
Expand Down Expand Up @@ -403,7 +404,7 @@ Example of usage:
... 'version': _('version', pre_release=True),
... 'timestamp': _('timestamp', posix=False),
... 'owner': {
... 'email': _('personal.email', key=str.lower),
... 'email': _('person.email', key=str.lower),
... 'token': _('token'),
... 'creator': _('full_name', gender=Gender.FEMALE),
... },
Expand Down
7 changes: 4 additions & 3 deletions mimesis/__init__.py
Expand Up @@ -9,9 +9,10 @@

__all__ = [
'Address',
'BaseDataProvider',
'BaseProvider',
'Business',
'ClothingSizes',
'ClothingSize',
'Code',
'Datetime',
'Development',
Expand All @@ -23,9 +24,9 @@
'Numbers',
'Path',
'Payment',
'Personal',
'Person',
'Science',
'Structured',
'Structure',
'Text',
'Transport',
'UnitSystem',
Expand Down
2 changes: 2 additions & 0 deletions mimesis/builtins/base.py
Expand Up @@ -2,6 +2,8 @@

from mimesis.providers import BaseProvider

__all__ = ['BaseSpecProvider']


class BaseSpecProvider(BaseProvider):
"""Base provider for specific data providers."""
Expand Down
2 changes: 2 additions & 0 deletions mimesis/builtins/de.py
Expand Up @@ -3,6 +3,8 @@
from mimesis.builtins.base import BaseSpecProvider
from mimesis.utils import pull

__all__ = ['GermanySpecProvider']


class GermanySpecProvider(BaseSpecProvider):
"""Specific-provider of misc data for Germany."""
Expand Down
2 changes: 2 additions & 0 deletions mimesis/builtins/en.py
Expand Up @@ -4,6 +4,8 @@

from mimesis.builtins.base import BaseSpecProvider

__all__ = ['USASpecProvider']


class USASpecProvider(BaseSpecProvider):
"""Class that provides special data for USA (en)."""
Expand Down
2 changes: 2 additions & 0 deletions mimesis/builtins/ja.py
Expand Up @@ -2,6 +2,8 @@

from mimesis.builtins.base import BaseSpecProvider

__all__ = ['JapanSpecProvider']


class JapanSpecProvider(BaseSpecProvider):
"""Class that provides special data for ja."""
Expand Down

0 comments on commit f92785f

Please sign in to comment.