-
Notifications
You must be signed in to change notification settings - Fork 3
/
dummy-ple.py
58 lines (41 loc) · 1.27 KB
/
dummy-ple.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import datetime
import pprint
import difflib
import random
_dict = {
"Nombre": "Dummy",
"Apellido": "bot",
"Edad": "",
"Escuela": "",
"Grado": ""}
topic = "Topics/Topic_4"
from Globales import get_vocabulario, guardar
def grabar(n=0):
today = datetime.date.today()
target = today + datetime.timedelta(n)
vocabulario = get_vocabulario(topic, _dict, force_date=target)
vocabulario = map(lambda x: x[1], vocabulario)
for item in vocabulario:
#if random.choice([True, False]):
n = random.choice([3,5])
guardar(_dict, os.path.abspath(topic), item, n, force_date=target)
def probar(n):
for dias in range(0,n):
today = datetime.date.today()
target = today + datetime.timedelta(dias)
try:
old_vocab = vocabulario[:]
except NameError:
old_vocab = []
vocabulario = get_vocabulario("Topics/Topic_4", _dict, force_date=target)
vocabulario = map(lambda x: x[1], vocabulario)
print "= Fecha", target
#for item in vocabulario:
#print list(difflib.unified_diff(old_vocab, vocabulario))
print len(vocabulario)
#pprint.pprint (vocabulario)
grabar(n)
if __name__ == '__main__':
#grabar()
probar(45)