示例#1
0
def import_real():
    reset()

    with open(
            os.path.dirname(os.path.realpath(__file__)) + '/data/real_dv.json',
            'r') as f:
        d = json.load(f)
    buff = []
    for i in d:
        if len(i) > 2:
            continue
        t = i[0]
        while True:
            buff.append(str(t))
            t += 60 * 15
            if t > i[1]:
                break

    while True:
        try:
            requests.post(LISTENER_ROUTE,
                          data={
                              'secret': SECRET,
                              'data': '\n'.join(buff)
                          })
            break
        except:
            pass
示例#2
0
def menu(pos):
    instruction = """Select:
(1) Display Seating Chart
(2) Sell one or more tickets
(3) Display statistics
(4) Reset program
(X) Exit program
"""
    select = raw_input(instruction)
    options = ["1", "2", "3", "4", "X"]
    if select == "1":
        printTheatre(pos)
        menu(pos)
    elif select == "2":
        sell(pos)
        menu(pos)
    elif select == "3":
        stats(pos)
        menu(pos)
    elif select == "4":
        reset(pos)
        menu(pos)
    elif select.lower() == "x":
        print("Have a bedraggled day ruffian :<")
    elif select not in options:
        print("Enter a number from 1 to 4 fool")
        menu(pos)
示例#3
0
def test_amulets():
  reset.reset(True)
  db.signup(1,'Alice',':hugging:')
  db.signup(2,'Bob',':smirk:')
  db.signup(3,'Charlie',':orange_book:')

  db.add_category(100,True)
  db.add_channel(10,1,True)
  db.add_channel(11,2,True)
  db.add_channel(12,1,True)

  db.add_secret_channel(10,'Amulet_Holder')
  db.add_secret_channel(11,'Amulet_Holder')

  db.set_user_in_channel(10,1,1)
  db.set_user_in_channel(10,2,3)
  db.set_user_in_channel(11,2,1)
  db.set_user_in_channel(12,1,1)
  db.set_user_in_channel(12,3,1)

  assert db.get_secret_channels('Amulet_Holder') == [10,11]

  assert db.amulets(1) == [10]
  assert db.amulets(2) == [10,11]
  assert db.amulets(3) == []
  assert db.has_amulet(1) == True
  assert db.has_amulet(3) == False
  reset.reset(True)
示例#4
0
def kill_queue_test():
  db.add_kill(12738912739821,"Barber")
  db.add_kill(12347892374923,"White Werewolf","7289347983274")
  assert db.get_kill() == [1,u'12738912739821',u'Barber',u'']
  assert db.get_kill() == [2,u'12347892374923',u'White Werewolf',u'7289347983274']
  assert db.get_kill() == None
  reset.reset(True)
  return True
示例#5
0
def main(argv):
    parser = argparse.ArgumentParser()
    parser.add_argument("--type", default=0, help="number of param")

    args = parser.parse_args()

    r.reset()
    train.main(args.type)
    m.main(args.type)
示例#6
0
def test_secrets():
  reset.reset(True)
  assert db.get_secret_channels('Assassin') == []
  db.add_secret_channel(1,'Assassin')
  db.add_secret_channel(2,'Assassin')
  assert db.get_secret_channels('Assassin') == [1,2]
  db.add_secret_channel(3,'Werewolf')
  assert db.get_secret_channels('Assassin') == [1,2]
  db.add_secret_channel(4,'Assassin')
  assert db.get_secret_channels('Assassin') == [1,2,4]
  reset.reset(True)
示例#7
0
def hard_reset(skip = False):
    if skip == False:
        confirm = input("Are you sure you want to reset the data? Any current game progress will be deleted.\nType 'Yes' to proceed. ")
        if confirm != 'Yes':
            print('Resetting canceled.')
            return
        confirm = input("Are you VERY sure? Not only will this delete the game database, also will it lose any other records.\nType 'Yes' to proceed. ")
        if confirm != 'Yes':
            print('Resetting canceled.')
            return

    # Despite confirmations, make one last back-up
    newpath = 'backup/last_reset'
    if not os.path.exists(newpath):
        os.makedirs(newpath)
    open('backup/last_reset/backup_game.db', 'a').close()
    open('backup/last_reset/backup_general.db', 'a').close()
    open('backup/last_reset/backup_stats.json', 'a').close()
    open('backup/last_reset/backup_dynamic.json', 'a').close()
    open('backup/last_reset/backup_config.py', 'a').close()
    copy(config.database,'backup/last_reset/backup_game.db')
    copy(config.general_database,'backup/last_reset/backup_general.db')
    copy(config.stats_file,'backup/last_reset/backup_stats.json')
    copy(config.dynamic_config,'backup/last_reset/backup_dynamic.json')
    copy('config.py','backup/last_reset/backup_config.py')

    # Reset the game table.
    reset.reset(True)
    print('\nDeleting any remaining data...')
    c.execute("DROP TABLE IF EXISTS 'inventory'")
    c.execute("DROP TABLE IF EXISTS 'users'")
    c.execute("DROP TABLE IF EXISTS 'activity'")
    c.execute("DROP TABLE IF EXISTS 'offers'")
    c.execute("DROP TABLE IF EXISTS 'requests'")
    c.execute("DROP TABLE IF EXISTS 'tokens'")
    c.execute("DROP TABLE IF EXISTS 'prizes'")
    c.execute("DROP TABLE IF EXISTS 'shops'")
    c.execute("DROP TABLE IF EXISTS 'sources'")
    if skip == False:
        print('Progress deleted!\n')
        print('Creating space for a new database....')
    c.execute("CREATE TABLE 'inventory' ('id' INTEGER NOT NULL, 'item' INTEGER NOT NULL, 'amount' INTEGER NOT NULL DEFAULT 0, FOREIGN KEY(`id`) REFERENCES `users`(`id`));")  
    c.execute("CREATE TABLE 'users' ('id' INTEGER NOT NULL, 'name' TEXT NOT NULL, 'credits' INTEGER NOT NULL DEFAULT 0, 'activity' INTEGER NOT NULL DEFAULT 0, 'roulette_record' INTEGER NOT NULL DEFAULT 0, 'refer_score' INTEGER NOT NULL DEFAULT 0, 'referrer' INTEGER NOT NULL DEFAULT 0, PRIMARY KEY('id'));")
    c.execute("CREATE TABLE 'activity' ('id' INTEGER NOT NULL, 'name' TEXT NOT NULL, 'activity' INTEGER NOT NULL DEFAULT 0, 'spam_activity' REAL NOT NULL DEFAULT 0, 'spam_filter' INTEGER NOT NULL DEFAULT 200, 'record_activity' REAL NOT NULL DEFAULT 0, FOREIGN KEY(`id`) REFERENCES `users`(`id`), PRIMARY KEY('id'));")
    c.execute("CREATE TABLE 'offers' ('id' INTEGER NOT NULL, 'emoji' TEXT NOT NULL, 'price' INTEGER NOT NULL, 'owner' INTEGER NOT NULL, FOREIGN KEY(`id`) REFERENCES `users`(`id`));")
    c.execute("CREATE TABLE 'requests' ('id' INTEGER NOT NULL, 'emoji' TEXT NOT NULL, 'price' INTEGER NOT NULL, 'owner' INTEGER NOT NULL, FOREIGN KEY(`id`) REFERENCES `users`(`id`));")
    c.execute("CREATE TABLE 'tokens' ( `token` TEXT NOT NULL, `owner` INTEGER NOT NULL, `status` INTEGER NOT NULL DEFAULT 0, `opt1` NUMERIC, `opt2` TEXT, `opt3` TEXT, `choice` TEXT, `source1` TEXT, `source2` TEXT, `creation` TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP, `redeemed` TEXT, `message` INTEGER NOT NULL, FOREIGN KEY(`owner`) REFERENCES `users`(`id`), PRIMARY KEY(`token`,`message`) )")
    c.execute("CREATE TABLE 'shops' ('item' INTEGER NOT NULL, 'price' REAL NOT NULL, 'bought' INTEGER NOT NULL DEFAULT 0, 'oldprice' REAL NOT NULL DEFAULT 0, PRIMARY KEY('item'));")
    c.execute("CREATE TABLE 'sources' ('user' INTEGER NOT NULL, 'source' TEXT NOT NULL, 'amount' INTEGER NOT NULL DEFAULT 1, FOREIGN KEY(`user`) REFERENCES `users`(`id`));")
    print('Formatting completed! The bot is now ready for a new game!\n')

    if skip == False:
        input("Press any button to exit this program.")
示例#8
0
def test_mexican():
    reset.reset(True)
    db.add_standoff(2, 'Huntress', 1)
    db.add_standoff(3, 'Cupid', 1)
    db.add_standoff(1, 'Cupid', 3)
    print(db.get_standoff(3))
    print(db.get_standoff(1))
    assert db.get_standoff(3) == [[3, '1', 'Cupid', '3']]
    assert db.get_standoff(1) == [[1, '2', 'Huntress', '1'],
                                  [2, '3', 'Cupid', '1']]
    db.delete_standoff(2)
    assert db.get_standoff(1) == [[1, '2', 'Huntress', '1']]
    reset.reset(True)
示例#9
0
def test_control_freezers():
    reset.reset(True)
    assert db.add_freezer(1, 3, 'Pyromancer') == None
    assert db.add_freezer(1, 3, 'The Thing') == 'Pyromancer'
    assert db.add_freezer(1, 4, 'Assassin') == None
    assert db.add_freezer(1, 3, 'Booh') == 'The Thing'
    assert db.add_freezer(1, 5, 'Hooker') == None
    assert db.add_freezer(2, 9, 'Fortune Teller') == None
    assert db.get_freezers(1) == [(3, 'Booh'), (4, 'Assassin'), (5, 'Hooker')]
    assert db.delete_freezer(1, 7) == False
    assert db.delete_freezer(1, 4) == True
    assert db.get_freezers(1) == [(3, 'Booh'), (5, 'Hooker')]
    reset.reset(True)
示例#10
0
def test_mexican():
  reset.reset(True)
  db.add_standoff(2,'Huntress',1)
  db.add_standoff(3,'Cupid',1)
  db.add_standoff(1,'Cupid',3)
  assert db.get_standoff(3) == [[3,'1','Cupid','3']]
  assert db.get_standoff(1) == [[1,'2','Huntress','1'],[2,'3','Cupid','1']]
  db.delete_standoff(2)
  assert db.get_standoff(1) == [[1,'2','Huntress','1']]
  db.add_standoff(4,'Hooker',3)
  assert db.get_standoff(3) == [[3,'1','Cupid','3'],[4,'4','Hooker','3']]
  db.delete_hookers()
  assert db.get_standoff(3) == [[3,'1','Cupid','3']]
  reset.reset(True)
示例#11
0
def test_database():
    reset.reset(True)
    assert db.count_categories() == 0
    assert db.get_category() == None
    assert db.get_columns() == []
    assert db.poll_list() == []
    db.signup(1, 'Randium003', u':smirk:')
    assert db.get_user(1) == (1, u'Randium003', u':smirk:', 0, game_log,
                              'Spectator', 'Spectator', 0, 1, 0, 0, 0, 0, 0, 0,
                              0, 0, -1, 0, '', 0, 0, 0)
    assert db.db_get(1, 'channel') == game_log
    assert db.isParticipant(1) == False
    assert db.isParticipant(1, True) == True
    assert db.isParticipant(2) == False
    assert db.isParticipant(2, True) == False
    db.db_set(1, 'frozen', 1)
    assert db.poll_list() == [(1, u':smirk:', 1, 0)]

    db.add_category('24')
    assert db.count_categories() == 1
    assert db.get_category() == 24
    assert db.get_columns() == [(1, )]
    assert db.channel_get('1234555') == None
    db.add_channel('1234555', 1)
    assert db.get_category() == 24
    db.add_channel('12211', 1)
    assert db.get_category() == 24
    assert db.channel_get('1234555') == (u'1234555', u'1', u'0')
    assert db.channel_change_all(1, 0, 1) == [u'1234555', u'12211']
    assert db.channel_get('1234555') == (u'1234555', u'1', u'1')
    assert db.channel_get('12211') == (u'12211', u'1', u'1')
    db.set_user_in_channel('1234555', 1, 2)
    assert db.channel_get('1234555') == (u'1234555', u'1', u'2')
    assert db.channel_get('1234555', 1) == '2'
    assert db.channel_change_all(1, 2, 3) == [u'1234555']
    assert db.unabduct(1) == [u'1234555']
    db.signup(420, "BenTechy66", ":poop:")
    assert db.channel_get('12211') == (u'12211', u'1', u'1', u'0')
    assert db.freeze('1') == [u'1234555', u'12211']
    assert db.abduct('420') == []

    for i in range(max_channels_per_category - 2):
        assert db.get_category() == 24
        db.add_channel(10 * i, 608435446804 + 7864467 * i)
    assert db.count_categories() == 1
    assert db.get_category() == None
    reset.reset(True)
示例#12
0
def dummy_historical():
    reset()

    start_time = 1431702000  # may 15th 2015
    tim = start_time
    end = int(time.time())

    rang = float(end - start_time)
    iters = 0
    buff = []
    while True:
        iters += 1
        tim += 60 * 15
        if random() < 0.2:
            buff.append(str(tim))
            while random() < 0.8:
                tim += 60 * 15
                buff.append(str(tim))

        if iters % 100 == 0:

            print round(((tim - start_time) / rang) * 100,
                        2), '% done', '\t\t\t\r',

            sys.stdout.flush()
            while True:
                try:
                    requests.post(LISTENER_ROUTE,
                                  data={
                                      'secret': SECRET,
                                      'data': '\n'.join(buff)
                                  })
                    break
                except:
                    pass
            buff = []

        if tim > end:
            break
示例#13
0
    def __init__(self, window):
        self.window = window

        cfg = configparser.ConfigParser()
        cfg.read('config.ini')

        self.data_filename = cfg.get('path', 'filename')

        self.questions = json.load(
            codecs.open(self.data_filename, 'r', 'utf-8'))
        if not self.candidate:
            reset()
            self.questions = json.load(
                codecs.open(self.data_filename, 'r', 'utf-8'))

        self.hav_show = False

        question_ft = tkFont.Font(family='Fixdsys',
                                  size=14,
                                  weight=tkFont.BOLD)
        entry_ft = tkFont.Font(family='Fixdsys', size=20, weight=tkFont.BOLD)
        answer_ft = tkFont.Font(family='Fixdsys', size=60, weight=tkFont.BOLD)

        self.question = Label(window, text="question...", font=question_ft)
        self.entry = Entry(window, font=entry_ft)
        self.answer = Label(window, text="answer...", font=answer_ft)

        self.question.pack(side=TOP, fill=BOTH)
        self.entry.pack(ipady=10, pady=40)
        self.answer.pack(side=TOP, fill=BOTH, expand=YES)

        self.entry['justify'] = CENTER

        self.entry.bind('<Return>', self.enter)

        self.cur = None
        self.next_question()
def test_reset(levels, original_determinant, other_determinants, setup_name):
    other_determinants.insert(0, original_determinant)
    old_shares = old_shares_to_dict(setup_name)
    new_structure2 = create_new_level_structure(levels, levels[-1][0] + 3,
                                                levels[-1][1] + 3, 1)
    print("\nCalling reset('{}', {}, new_shares={}):".format(
        setup_name, old_shares, new_structure2))
    shares = reset(setup_name,
                   old_shares,
                   new_shares=new_structure2,
                   print_statements=print_statements)
    print("New shares after reset are:")
    for each_share in shares:
        print(each_share, ":", shares[each_share])
    print("Reset successful.")
    return old_shares
示例#15
0
import sys
import check
import work
from reset import reset
import sync

if __name__ == '__main__':
  # get appropriate functions
  check_func = sys.argv[1]
  work_func = getattr(work, sys.argv[2])
  if len(sys.argv) > 3:
    sync_func = getattr(sync, sys.argv[3])
  else:
    sync_func = sync.sync
  # execute!
  reset()
  sync_func()
  getattr(check, check_func)(work_func)
  reset()
示例#16
0
文件: start.py 项目: xavraspi/bin
        ctrl2Roues.TOURNER_GAUCHE(6)
        ctrl2Roues.TOURNER_DROITE(12)
        ctrl2Roues.TOURNER_GAUCHE(12)
        ctrl2Roues.GPIO_SETUP(0,0,0,0,0,0,0,0)
   elif keyboard.is_pressed('y'): # YES 
        Action('YES')
        ctrl2Roues.MARCHE_AVANT(10)
        ctrl2Roues.MARCHE_ARRIERE(10)
        ctrl2Roues.MARCHE_AVANT(5)
        ctrl2Roues.MARCHE_ARRIERE(3)
        ctrl2Roues.MARCHE_AVANT(5)
        ctrl2Roues.MARCHE_ARRIERE(3)
        ctrl2Roues.GPIO_SETUP(0,0,0,0,0,0,0,0)
   elif keyboard.is_pressed('m'): # mesurer distance
        Action('MESURE')
        captHC.dist(1) 
   elif keyboard.is_pressed('t'):
        Action('TEMPRESSION')
        bmp280.bmp280()            
   elif keyboard.is_pressed('A'):
        Action('AUTO')
        autoHC.auto(15)            
   elif keyboard.is_pressed('space'):
        Action('meteo')
        time.sleep(1)
   elif keyboard.is_pressed('r'):
        Action('RESET')
        reset.reset(0)
        

'dbrightness': 20,
'ddbrightness': 0
}

osc.TARGET = {
'r': 255,
'g': 255,
'b': 255,
'brightness': 150,
'enabled': True,
'reached': False
}

osc.MODE = osc.MODES['BRIGHTNESS']

reset.reset(lights, osc.OPTIONS)

while True:
    if up:
        sys.stdout.write('↑ ')
    else:
        sys.stdout.write('↓ ')
    sys.stdout.flush()
    for light in lights:
        osc.oscilliate(light, up)
        # print(light.xy)
        # print(light.brightness)
    up = not up
    if up: #after up, up is not up and DOWN_DELAY is needed
        time.sleep(osc.DELAYS[delay_mode][osc.UP])
    else:
示例#18
0
	def Execute(self):
		self.FSM.SetState(reset.reset())
		self.FSM.Execute()
示例#19
0
def reset_state():
    reset()
    return redirect(url_for("index"))
示例#20
0
def adminLogin(flag=0):
    Aid = ""
    #admin login should work only once that is why flag is set to zero
    if flag == 0:
        system('cls')
        file = open("admin.txt", "rb")
        d = p.load(file)
        name = input("Enter your name: ")
        passw = gp.getpass("Enter your password: "******"Enter the correct username and password !!!")
            print("Press enter to continue")
            ch = gp.getpass("")
            system('cls')
            menu()
    system('cls')
    print('''
		ADMINISTRATOR SERVICES

	1)  VIEW ALL USERS
	2)  DELETE USER
	3)  VIEW ALL DEALERS 
	4)  DELETE DEALER
	5)  VIEW ALL CABS
	6)  DELETE CAB
	7)  ADD NEW ADMIN
	8)  CHANGE PASSWORD
	9)  VIEW ALL ADMIN
	10) RESET DATA
	11) UPDATE PROFILE
	12) LOGOUT

	''')
    ch = input("ENTER YOUR CHOICE: ")
    if ch == '1':
        details("user.txt")
        adminLogin(1)
    elif ch == '2':
        rem("user.txt")
        adminLogin(1)
    elif ch == '3':
        details("dealer.txt")
        adminLogin(1)
    elif ch == '4':
        rem("dealer.txt")
        adminLogin(1)
    elif ch == '5':
        cabOpt(2)
        adminLogin(1)
    elif ch == '6':
        cabOpt(4, "", "admin.txt")
        adminLogin(1)
    elif ch == '7':
        newAdm()
        adminLogin(1)
    elif ch == '8':
        newAdm(1)
        adminLogin(1)
    elif ch == '9':
        details("admin.txt")
        adminLogin(1)
    elif ch == '10':
        res.reset()
        system('cls')
        print("All data set to null and Admin made default")
        ch = gp.getpass("Press enter to continue")
        system('cls')
        adminLogin(1)
        menu()
    elif ch == '11':
        system('cls')
        f = open("admin.txt", "rb")
        d = p.load(f)
        f.close()
        file = open("admin.txt", "wb")
        l = []
        s = input("Enter your name: ")
        l.append(s)
        d[Aid][0] = l[0]
        p.dump(d, file)
        file.close()
        k = gp.getpass("Press enter to continue")
        adminLogin(1)
    elif ch == '12':
        print("Logging out....")
        sleep(1)
        system('cls')
        menu()
    else:
        print("Enter a correct option !!!")
        k = gp.getpass("Press enter to continue")
        system('cls')
        adminLogin(1)
示例#21
0
    # Init GPS CSV file
    write_line(dashgps.get_gps_csv_header(), gps_outfile)
    
    # Main Loop
    while True:
        # wait for a while
        time.sleep(10)

        # Get an id for this position report
        identifier = str(uuid.uuid4())

        # Get GPS Position Report
        report = dashgps.get_posit(gps_session, identifier)
        save_report(report, gps_outfile)

        # Automatically handle reset
        if report.lat == None:
            # If we get a null position report, light up the warning LED.
            GPIO.output(7, True)
            currentFailures += 1
            if currentFailures > maxFailuresmax:
                GPIO.output(7, False)
                reset.reset()
        else:
            # if the position report is good, turn out the light.
            GPIO.output(7, False)
            currentFailures = 0

        # Get Photo
        dashcam.take_picture(cam, pic_dir + "/" + identifier + ".jpg")
示例#22
0
def scanstart():
    reset()
    dist_updater.reset_globals()
    return Response('scan started')
示例#23
0
import os
from menu import menu
from printTheatre import printTheatre
from reset import reset
from save import save
from load import load

pos = []
temp = []

f = open("theater.txt", "a+") # if theater.txt does not exist, create theater.txt

if os.stat("theater.txt").st_size == 0: # if theater.txt is empty, create pos
    reset(pos)
    print("Instantiated theater.txt")

else: # else load pos from theater.txt
    load(pos)
    print("Loaded theater.txt")

menu(pos) # run program

save(pos) # save pos to theater.txt
示例#24
0
def pushpull(options=tuple(),
             out_file=sys.stdout,
             err_file=sys.stderr,
             mode='push',
             verbose=0,
             yes=None):
    # load config
    try:
        root_dir = find_root_dir()
        config_dir = find_config_dir()
        config = load_config()
        state = load_state()
    except RootNotFoundError:
        print(ROOT_NOT_FOUND_ERROR_STR, file=err_file)
        return 1
    except InvalidConfigError:
        print(CONFIG_ERROR_STR, file=err_file)
        return 1
    except InvalidStateError:
        print(STATE_ERROR_STR, file=err_file)
        return 1
    # load args
    parser = argparse.ArgumentParser()
    for (args, kwargs) in ARGS:
        parser.add_argument(*args, **kwargs)
    parser.add_argument('options', nargs=argparse.REMAINDER)
    args = parser.parse_args(options)
    remote_name = args.remote
    if remote_name not in config['remote']:
        print(REMOTE_NOT_FOUND_ERROR_STR.format(remote_name))
        return 1
    bin = config['bin']
    remote = config['remote'][remote_name]
    filter_file_path = os.path.join(config_dir, FILTER_LIST_FILE_NAME)
    rclone_args = [bin, 'sync']
    rclone_args += remote.get('flags', [])
    rclone_args += args.options
    rclone_args += ['--filter-from', filter_file_path]
    if 'include' not in state or \
        (isinstance(state['include'], list) and len(state['include']) == 0):
        print(NO_FILE_STR, file=err_file)
        return 1
    with open(filter_file_path, 'w') as filter_file:
        # open file
        for exclude_item in config['exclude']:
            filter_file.write('- ' + exclude_item + '\n')
            # do not include config folder
        filter_file.write('- ' + os.sep + HELPER_DIRECTORY_NAME + os.sep +
                          '\n')
        file_list = state['include']
        if isinstance(state['include'], list):
            for (file_path, file_type) in file_list:
                if file_type == 'dir':
                    dir_path = file_path if file_path.endswith(
                        os.sep) else file_path + os.sep
                    dir_path_escaped = escape(dir_path) + '**'
                    filter_file.write('+ ' + dir_path_escaped + '\n')
                escaped = escape(file_path)
                filter_file.write('+ ' + escaped + '\n')
        # all files included
        elif state['include'] == 'all':
            pass
        else:
            pass
    if mode == 'push':
        rclone_args += [root_dir, remote_name + ':' + remote['dir']]
    elif mode == 'pull':
        rclone_args += [remote_name + ':' + remote['dir'], root_dir]
    print(*rclone_args, file=err_file)
    if not yes:
        subprocess.call(rclone_args + ['--dry-run'],
                        stdout=out_file,
                        stderr=err_file)
    prompt_answer = 'y' if yes else input('Is that OK? {y,n} ')
    if prompt_answer == 'y':
        subprocess.call(rclone_args, stdout=out_file, stderr=err_file)
        reset()
        return 0
    else:
        return 1
示例#25
0
 def reset(self):
     reset(Game, Piece, Login, self)
示例#26
0
 def reset(self):
     texto1 = self.textbox1
     texto2 = self.textbox2
     texto3 = self.textbox3
     texto4 = self.textbox4
     reset(texto1,texto2,texto3,texto4)
示例#27
0
def hard_reset(skip=False):
    if skip == False:
        confirm = input(
            "Are you sure you want to reset the data? Any current game progress will be deleted.\nType 'Yes' to proceed. "
        )
        if confirm != 'Yes':
            print('Resetting canceled.')
            return
        confirm = input(
            "Are you VERY sure? Not only will this delete the game database, also will it lose any other records.\nType 'Yes' to proceed. "
        )
        if confirm != 'Yes':
            print('Resetting canceled.')
            return

    # Reset the game table.
    reset.reset(True)
    print('\nDeleting any remaining data...')
    c.execute("DROP TABLE IF EXISTS 'inventory'")
    c.execute("DROP TABLE IF EXISTS 'users'")
    c.execute("DROP TABLE IF EXISTS 'activity'")
    c.execute("DROP TABLE IF EXISTS 'offers'")
    c.execute("DROP TABLE IF EXISTS 'requests'")
    c.execute("DROP TABLE IF EXISTS 'tokens'")
    c.execute("DROP TABLE IF EXISTS 'prizes'")
    c.execute("DROP TABLE IF EXISTS 'shops'")
    if skip == False:
        print('Progress deleted!\n')
        print('Creating space for a new database....')
    c.execute(
        "CREATE TABLE 'inventory' ('id' INTEGER NOT NULL, 'name' TEXT NOT NULL, \
	'000' INTEGER NOT NULL DEFAULT 0, \
	'001' INTEGER NOT NULL DEFAULT 0, \
	'002' INTEGER NOT NULL DEFAULT 0, \
	'003' INTEGER NOT NULL DEFAULT 0, \
	'004' INTEGER NOT NULL DEFAULT 0, \
	'005' INTEGER NOT NULL DEFAULT 0, \
	'006' INTEGER NOT NULL DEFAULT 0, \
	'007' INTEGER NOT NULL DEFAULT 0, \
	'008' INTEGER NOT NULL DEFAULT 0, \
	'009' INTEGER NOT NULL DEFAULT 0, \
	'010' INTEGER NOT NULL DEFAULT 0, \
	'011' INTEGER NOT NULL DEFAULT 0, \
	'012' INTEGER NOT NULL DEFAULT 0, \
	'013' INTEGER NOT NULL DEFAULT 0, \
	'014' INTEGER NOT NULL DEFAULT 0, \
	'015' INTEGER NOT NULL DEFAULT 0, \
	'100' INTEGER NOT NULL DEFAULT 0, \
	'101' INTEGER NOT NULL DEFAULT 0, \
	'102' INTEGER NOT NULL DEFAULT 0, \
	'103' INTEGER NOT NULL DEFAULT 0, \
	'104' INTEGER NOT NULL DEFAULT 0, \
	'105' INTEGER NOT NULL DEFAULT 0, \
	'106' INTEGER NOT NULL DEFAULT 0, PRIMARY KEY('id'));")
    c.execute(
        "CREATE TABLE 'users' ('id' INTEGER NOT NULL, 'name' TEXT NOT NULL, 'credits' INTEGER NOT NULL DEFAULT 0, 'activity' INTEGER NOT NULL DEFAULT 0, 'age' INTEGER NOT NULL DEFAULT 0, PRIMARY KEY('id'));"
    )
    c.execute(
        "CREATE TABLE 'activity' ('id' INTEGER NOT NULL, 'name' TEXT NOT NULL, 'activity' INTEGER NOT NULL DEFAULT 0, 'spam_activity' REAL NOT NULL DEFAULT 0, 'spam_filter' INTEGER NOT NULL DEFAULT 200, 'record_activity' REAL NOT NULL DEFAULT 0, PRIMARY KEY('id'));"
    )
    c.execute(
        "CREATE TABLE 'offers' ('id' INTEGER NOT NULL, 'emoji' TEXT NOT NULL, 'price' INTEGER NOT NULL, 'owner' INTEGER NOT NULL, PRIMARY KEY('id'));"
    )
    c.execute(
        "CREATE TABLE 'requests' ('id' INTEGER NOT NULL, 'emoji' TEXT NOT NULL, 'price' INTEGER NOT NULL, 'owner' INTEGER NOT NULL, PRIMARY KEY('id'));"
    )
    c.execute(
        "CREATE TABLE 'tokens' ('token' TEXT NOT NULL, 'owner' INTEGER NOT NULL, 'status' INTEGER NOT NULL DEFAULT 0, 'opt1' TEXT, 'opt2' TEXT, 'opt3' TEXT, 'choice' TEXT, 'source1' TEXT, 'source2' TEXT, PRIMARY KEY('token'));"
    )
    c.execute(
        "CREATE TABLE 'prizes' ('prize' INTEGER NOT NULL, 'option' INTEGER NOT NULL DEFAULT 0, 'choice' INTEGER NOT NULL DEFAULT 0, PRIMARY KEY('prize'));"
    )
    c.execute(
        "CREATE TABLE 'shops' ('message' INTEGER NOT NULL, 'age' INTEGER NOT NULL DEFAULT 0, PRIMARY KEY('message'));"
    )
    print('Formatting completed! The bot is now ready for a new game!\n')

    if skip == False:
        input("Press any button to exit this program.")
示例#28
0
文件: main.py 项目: 31core/PyVCS
import os
import sys
import staging
import commit
import log
import reset
import restore


def init():
    os.mkdir(".vcs")
    os.mkdir(".vcs/staging")


staging = staging.staging()
if __name__ == "__main__":
    if sys.argv[1] == "init":
        init()
    elif sys.argv[1] == "add":
        staging.add(sys.argv[2])
    elif sys.argv[1] == "restore":
        restore.restore(sys.argv[2])
    elif sys.argv[1] == "commit":
        commit.commit()
    elif sys.argv[1] == "log":
        for i in log.get_log_line():
            print(i)
    elif sys.argv[1] == "reset":
        reset.reset()
示例#29
0
def reset_workspace():
    reset.reset()
    return dumps({})