Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def numbers():
"""
:return:
"""
return Numbers()
def n1(self, seed):
return Numbers(seed=seed)
def n2(self, seed):
return Numbers(seed=seed)
def numbers(self):
return Numbers()
def populate(comments: Sequence['Comment'], authors: Sequence['People'],
count=100) -> Generator['Article', None, None]:
import mimesis
aid = mimesis.Numbers()
article = mimesis.Text()
answers = list(comments)
def get_random_answers(max):
counter = 0
while answers and counter < max:
yield answers.pop(random.randint(0, len(answers) - 1))
counter += 1
return (
Article(
id=aid.between(1, count),
title=article.title(),
author=random.choice(authors),
comments=[c for c in get_random_answers(random.randint(1, 10))]
)
def populate(authors: Sequence['People'],
count=100) -> Generator['Comment', None, None]:
import mimesis
cid = mimesis.Numbers()
comment = mimesis.Text()
return (
Comment(id=cid.between(1, count),
body=comment.sentence(),
author=random.choice(authors))
for _ in range(count)
)
from mimesis import Datetime, Numbers, Text, Business
from random import random
from numpy import random as npr
from math import ceil
from uuid import uuid4
from .Node import Node
class Transaction(Node):
_datetime = Datetime()
_numbers = Numbers()
_text = Text()
_business = Business()
def __init__(self, sourceId, targetId):
self.__type = 'Transaction'
self.id = uuid4()
self.source = sourceId
self.target = targetId
self.date = self._datetime.date(start=2015, end=2019)
self.time = self._datetime.time()
if random() < 0.05:
self.amount = self._numbers.between(100000, 1000000)
else:
self.amount = npr.exponential(10)