コード例 #1
0
    def __init__(self, locale: str = 'en', seed: Optional[int] = None) -> None:
        """Initialize field.

        :param locale: Locale
        :param seed: Seed for random.
        """
        self.locale = locale
        self.seed = seed
        self.gen = Generic(self.locale, self.seed)
コード例 #2
0
    def __init__(self,
                 locale: Optional[str] = None,
                 seed: Optional[Seed] = None) -> None:
        """Initialize field.

        :param locale: Locale
        :param seed: Seed for random.
        """
        self.locale = locale
        self.seed = seed
        self._gen = Generic(self.locale, self.seed)
        self._table = {}  # type: ignore
コード例 #3
0
    def __init__(self, locale: str = 'en',
                 seed: Optional[Seed] = None,
                 providers: Optional[Any] = None) -> None:
        """Initialize field.

        :param locale: Locale
        :param seed: Seed for random.
        """
        self.locale = locale
        self.seed = seed
        self._gen = Generic(self.locale, self.seed)

        if providers:
            self._gen.add_providers(*providers)

        self._table = {}  # type: ignore
コード例 #4
0
ファイル: schema.py プロジェクト: lk-geimfari/mimesis
    def __init__(
        self,
        locale: Locale = Locale.DEFAULT,
        seed: Seed = None,
        providers: t.Optional[t.Sequence[t.Any]] = None,
    ) -> None:
        """Initialize field.

        :param locale: Locale
        :param seed: Seed for random.
        """
        self._gen = Generic(locale, seed)

        if providers:
            self._gen.add_providers(*providers)

        self._table = {}  # type: ignore
コード例 #5
0
ファイル: fill_db.py プロジェクト: dhconnelly/lastweek
def fill_db(
    db, password="******", user_count=20, tag_count=100, snippet_count=1000
):
    print("Filling dev database with fake data...")
    db.create_all()
    faker = LastweekFaker(db, Generic())
    for i in range(user_count):
        faker.fake_user(password)
    print(f"Created {user_count} users.")
    for i in range(tag_count):
        faker.fake_tag()
    print(f"Created {tag_count} tags.")
    for i in range(snippet_count):
        faker.fake_snippet()
    print(f"Created {snippet_count} snippets.")
    print(f"Committing to database...")
    faker.commit_all()
    print("Done.")
コード例 #6
0
ファイル: schema.py プロジェクト: pmshenoy/mimesis
 def __init__(self, locale: str = 'en', seed: bool = None) -> None:
     self.locale = locale
     self.seed = seed
     self.gen = Generic(self.locale, self.seed)
コード例 #7
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.generic = Generic(self.locale)