示例#1
0
文件: __main__.py 项目: tbenz9/tory
def main():
    args = parse_input() 

    if args.command == 'disks':
        if args.j_flag:
            pprint.pprint(json.dumps(inventory.get_disk_partitions(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            pass # need to make this
        elif args.d_flag:
            flaskr.insert('disks', json.dumps(inventory.get_disk_partitions(), sort_keys=True, separators=(',', ': ')))
        elif args.s_flag:
            flaskr. retrieve('disks')
        else: 
            pprint.pprint(inventory.get_disk_partitions())
   
    if args.command == 'network':
        if args.j_flag:
            pprint.pprint(json.dumps(network.get_network_info(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            human_read.net_human(network.get_network_info())
        elif args.d_flag:
            flaskr.insert('network', json.dumps(network.get_network_info(), sort_keys=True, separators=(',', ': ')))
        elif args.s_flag:
            flaskr.retrieve('network')
        else:
            pprint.pprint(network.get_network_info())
   
    if args.command == 'cpu':
        if args.j_flag:
            pprint.pprint(json.dumps(cpu.mch_cpu(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            human_read.cpu_human(cpu.mch_cpu())
        elif args.d_flag:
            flaskr.insert('cpu', json.dumps(cpu.mch_cpu(), sort_keys=True, separators=(',', ': ')))
        elif args.s_flag:
            flaskr.retrieve('cpu')
        else:
            pprint.pprint(cpu.mch_cpu())
   
    if args.command == 'ram':
        if args.j_flag:
            pprint.pprint(json.dumps(ram.get_ram_partitions(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            human_read.ram_human(ram.get_ram_partitions())
        elif args.d_flag:
            flaskr.insert('ram', json.dumps(ram.get_ram_partitions(), sort_keys=True, separators=(',', ': ')))
        elif args.s_flag:
            flaskr.retrieve('ram')
        else:
	        pprint.pprint(ram.get_ram_partitions())
   
    if args.command == 'user':
        if args.j_flag:
            pprint.pprint(json.dumps(user.get_users(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            human_read.users_human(user.get_users())
        elif args.d_flag:
            flaskr.insert('user', json.dumps(user.get_users(), sort_keys=True, separators=(',', ': ')))
        elif args.s_flag:
            flaskr.retrieve('user')
        else:
            pprint.pprint(user.get_users())
   
    if args.command == 'simple':
        if args.j_flag:
	        pprint.pprint(json.dumps(simple.get_simple_info(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
	        human_read.simple_human(simple.get_simple_info())
        elif args.d_flag:
            flaskr.insert('simple', json.dumps(simple.get_simple_info(), sort_keys=True, separators=(',', ': ')))
        elif args.s_flag:
            flaskr.retrieve('simple')
        else:
	        pprint.pprint(simple.get_simple_info())
   
    if args.command == 'pack':
        str_name= ''
        if args.PACKAGE:
            str_name=args.PACKAGE
        pprint.pprint(pack.get_pack(str_name))
示例#2
0
文件: main.py 项目: rtut/text_fool
    for z in frag_hand:
        suit_frag = str(z).split('-')
        weight_frag = card_weight(z, trump_suit, suit_frag[1])
        list_variant.append([z, weight_frag])
        list_variant_weight.append(weight_frag)
    min_weight = min(list_variant_weight)
    for x, y in list_variant:
        if (y == min_weight or y == min_weight+14) and x not in buffer :
            buffer.append(x)
    print ('Оппонент атаковал картами: ', buffer)
    return buffer

# if not imports
if __name__ == "__main__":
    pack = init_pack()
    trump_suit = trump(get_pack())
    my_hand= []  #количество карт на моих руках
    frag_hand = []   #количество карт на руках врага
    my_hand = my_card(pack, my_hand)
    frag_hand = frag_card(pack, frag_hand)
    #print ('карты врага!!!!: ', frag_hand)
    y = 0
    move = 0
    win = 0
    add_remove_card = []
    while True: #начало игры
        x, y = pack(0)
        if not y or (len(my_hand)>0 and len(frag_hand)>0):
            if move == 0:
                print ('=====Ваш ход=====')
                attack_card = my_fight(my_hand)