Typové anotace a další detaily v generování testdat k soustredeni
This commit is contained in:
parent
0b0a939de5
commit
6a781323e0
2 changed files with 21 additions and 5 deletions
|
@ -837,10 +837,10 @@ def create_test_data(size = 6, rnd = None):
|
|||
gen_ulohy_k_tematum(rnd, rocniky, rocnik_cisla, rocnik_temata, organizatori, resitele)
|
||||
|
||||
#generování soustředění
|
||||
soustredeni = gen_soustredeni(size, rnd, resitele, organizatori)
|
||||
soustredeni = gen_soustredeni(size, resitele, organizatori, rnd=rnd)
|
||||
|
||||
#generování konfer
|
||||
konfery = gen_konfery(size, rnd, organizatori, resitele, soustredeni)
|
||||
konfery = gen_konfery(size, organizatori, resitele, soustredeni, rnd=rnd)
|
||||
|
||||
# vytvoreni pdf ke korekturam
|
||||
create_test_pdf(rnd, organizatori)
|
||||
|
|
|
@ -1,16 +1,25 @@
|
|||
import logging
|
||||
import datetime
|
||||
import random
|
||||
from typing import Sequence
|
||||
|
||||
import lorem
|
||||
|
||||
from .models import Soustredeni, Konfera
|
||||
import seminar.models.tvorba as am
|
||||
import personalni.models as pm
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def gen_soustredeni(size, rnd, resitele, organizatori):
|
||||
logger.info('Generuji soustředění...')
|
||||
def gen_soustredeni(
|
||||
size: int,
|
||||
resitele: Sequence[pm.Resitel],
|
||||
organizatori: Sequence[pm.Organizator],
|
||||
rnd: random.Random = None,
|
||||
) -> Sequence[Soustredeni]:
|
||||
logger.info('Generuji soustředění (size={})...')
|
||||
rnd = rnd or random.Random(x=42)
|
||||
|
||||
soustredeni = []
|
||||
for _ in range(1, 10): # FIXME Tu range si změňte jak chcete, nevím, co přesně znamená size (asi Anet?)
|
||||
|
@ -35,8 +44,15 @@ def gen_soustredeni(size, rnd, resitele, organizatori):
|
|||
return soustredeni
|
||||
|
||||
|
||||
def gen_konfery(size, rnd, organizatori, resitele, soustredeni):
|
||||
def gen_konfery(
|
||||
size: int,
|
||||
organizatori: Sequence[pm.Organizator],
|
||||
resitele: Sequence[pm.Resitel],
|
||||
soustredeni: Sequence[Soustredeni],
|
||||
rnd: random.Random = None,
|
||||
) -> Sequence[Konfera]:
|
||||
logger.info('Generuji konfery (size={})...'.format(size))
|
||||
rnd = rnd or random.Random(x=42)
|
||||
|
||||
konfery = []
|
||||
for _ in range(1, size): # FIXME Tu range si změňte jak chcete, nevím, co přesně znamená size (asi Anet?)
|
||||
|
|
Loading…
Reference in a new issue