Пример #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
    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
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
 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)