예제 #1
0
파일: nodups.py 프로젝트: decretist/Sand
def main():
    (packages, dictionary) = parse.parse_all()
    for package in packages:
        T_A_flag = False
        T_P_flag = False
        T_Q_flag = False
        T_R_flag = False
        for part in dictionary[package]:
            tag = part[0]
            text = part[1]
            if tag == '<T A>':
                if T_A_flag:
                    print('Warning: multiple <T A> tags: ' + package, file=sys.stderr)
                else:
                    T_A_flag = True
            if tag == '<T Q>':
                if T_Q_flag:
                    print('Warning: multiple <T Q> tags: ' + package, file=sys.stderr)
                else:
                    T_Q_flag = True
            if tag == '<T P>':
                if T_P_flag:
                    print('Warning: multiple <T P> tags: ' + package, file=sys.stderr)
                else:
                    T_P_flag = True
            if tag == '<T R>':
                if T_R_flag:
                    print('Warning: multiple <T R> tags: ' + package, file=sys.stderr)
                else:
                    T_R_flag = True
예제 #2
0
파일: xform.py 프로젝트: decretist/Sand
def xform():
    toc_Fr = []
    dictionary_Fr = {}
    (canons, intermediate) = parse.parse_all()
    for canon in canons:
        for node in intermediate[canon]:
            tag = node[0]
            text = node[1]
            if tag == '<T A>':
                if re.search('d.a.c.1', canon):
                    key = canon
                else: # special case C.16 q.2 d.a.c.8
                    key = re.sub('c.', 'd.a.c.', canon)
                toc_Fr.append(key)
                dictionary_Fr[key] = text
            if tag == '<T I>':
                key = canon + ' (i)'
                if key in dictionary_Fr:
                    key = canon
                    text = dictionary_Fr[key] + ' ' + text
                else:
                    toc_Fr.append(key)
                dictionary_Fr[key] = text
            if tag == '<T P>':
                key = re.sub('c.', 'd.p.c.', canon)
                if key in dictionary_Fr:
                    text = dictionary_Fr[key] + ' ' + text
                else:
                    toc_Fr.append(key)
                dictionary_Fr[key] = text
            if tag == '<T Q>':
                key = canon
                toc_Fr.append(key)
                dictionary_Fr[key] = text
            if tag == '<T R>':
                key = canon + ' (r)'
                toc_Fr.append(key)
                dictionary_Fr[key] = text
            if tag == '<T T>':
                key = canon
                if key in dictionary_Fr:
                    text = dictionary_Fr[key] + ' ' + text
                else:
                    toc_Fr.append(key)
                dictionary_Fr[key] = text
    return(toc_Fr, dictionary_Fr)
예제 #3
0
def collect_data(goal, balance, moves):
    buttons = []
    continue_on = True
    while continue_on:
        print(f'BUTTONS: {buttons}')
        new_button = input('Next Button: ')
        button = parse.parse_all(new_button)
        buttons.append(button)
        decision = input('Would you like to add another button? y or n : ')
        if decision.lower() == 'y':
            continue_on = True
        else:
            continue_on = False
    else:
        print(buttons)
        print(
            app.solver(goal=goal,
                       moves=moves,
                       balance=balance,
                       buttons=buttons))
예제 #4
0
파일: main.py 프로젝트: decretist/Gratian
def main():
    file = open('./edF.txt', 'r').read()
    decretum = parse.parse_all(preprocess(file))
    traverse(decretum[0])
    traverse(decretum[1])
    traverse(decretum[2])
예제 #5
0
파일: run.py 프로젝트: Nikitalavrik/Lem-in
		g.x = g.x * koef[0] + 160 - max_x * 2
		g.y = g.y * koef[1] + 80 - max_y * 2
		obj = GameObject(g.x, g.y, node_image, name=g.name)
		game.objects.append(obj)

def create_ants(game, start, num_of_ants):
	ants = []
	for _ in range(num_of_ants):
		obj = GameObject(start.x, start.y, ant_image)
		ants.append(obj)
		game.objects.append(obj)
	return (ants)

if (len(sys.argv) == 3 and sys.argv[1] == "-f"):
	try:
		start, num_of_ants, ants_moves, graph = parse_all(sys.argv[2], 0)
	except:
		print("Bad file name")
		exit(0)
elif (len(sys.argv) == 1):
	try:
		start, num_of_ants, ants_moves, graph = parse_all("", 1)
	except:
		print("Bad file name")
		exit(0)
else:
	print("Enter filename")	
	# start, num_of_ants, ants_moves, graph = parse_all(sys.argv[1])

end = find_node(graph, ants_moves[-1][-1].move)
if len(graph) > 20: