def main(): args = getArgs() print(args) if args.dir_of_db is None: args.dir_of_db = findRepositoryByBackTracking() print("Using repository in: %s" % args.dir_of_db) db_fullpath = os.path.join(args.dir_of_db, DB_SUBFOLDER, DB_FILENAME) (db_folder, throwaway) = os.path.split(db_fullpath) if args.build_cache == True or not os.path.isdir(db_folder): db.reset(db_folder) db.createAndIndex(db_fullpath, args.dir_of_db) if args.build_cache == True: exit(0) strToSearch = " ".join(args.search_string) #strToSearch = args.search_string if args.search_filename: db.searchFilename(db_fullpath, strToSearch, args.regex) exit(0) if args.search_filename_path: db.searchFilenamePath(db_fullpath, strToSearch, args.regex) exit(0) db.search(db_fullpath, strToSearch, filterExtStrToArray(args.extension_filter), args.regex)
def start_ui(): db.reset(settings.DATABASE) handler = BarChartHandler() source = HistSource(generator=SQLiteGenerator()) model = BarChart() model.configure(source, 'x', 'y', value_range_kw = { "low" : 0.0, "high" : 1.0 }, index_title = 'Value', value_title = 'Probability') view = View(Item('plot', editor = ComponentEditor(size=(400,400)), show_label = False), title = "Church", resizable = True, height = 400, width = 360) model.configure_traits(handler=handler, view=view)
def start_ui(): db.reset(settings.DATABASE) handler = BarChartHandler() source = HistSource(generator=SQLiteGenerator()) model = BarChart() model.configure(source, 'x', 'y', value_range_kw={ "low": 0.0, "high": 1.0 }, index_title='Value', value_title='Probability') view = View(Item('plot', editor=ComponentEditor(size=(400, 400)), show_label=False), title="Church", resizable=True, height=400, width=360) model.configure_traits(handler=handler, view=view)
def load_file(csv_file): """Reset the database, load data from file, and update views""" db.reset() conn = psycopg2.connect(Database.URL) cur = conn.cursor() log(f'\nLoading request data from {csv_file}') records_written = 0 with gzip.open(csv_file, 'rt') as f: reader = csv.reader(f) next(reader) # Skip the header row. for row in reader: row[:] = [None if i == "" else i for i in row] cur.execute( """ INSERT INTO requests VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", row) records_written += 1 conn.commit() log(f'\nLoading complete: {records_written} records written to requests') cur.close() conn.close() # finish up views.refresh() info.update() if Picklecache.ENABLED: cache.clean()
import sys sys.path.append('/'.join(sys.path[0].split('/')[0:-1])) sys.path.append('/'.join(sys.path[0].split('/')[0:-2])) import a_api import db #making the account x = a_api.make_account({"username": "******", "password": "******"}) #checking the server response if x.status_code != 400: db.reset() raise Exception( f"Account creation w/ no email did not return 400 response, instead returned {x.status_code}" ) db.reset()
def reset(): db.reset() print('Database reset.') exit
def setup(): os.environ['DATABASE_URI'] = DATABASE_URI db.reset(DATABASE_URI) db.seed(DATABASE_URI)
import json, xmltodict, MySQLdb from config import config from db import reset items = [] monsters = [] monster_drops = [] drop_table = dict() affixs = [] manuals = [] reset(config) #drop_table -> monster -> tier -> item -> { prob, prefix, suffix, type } def populate(pTable): for dType in ["Drop1", "Drop2", "Drop3"]: if len(pTable[dType]) < 1: continue if pTable["TypeID"] not in drop_table: drop_table[pTable["TypeID"]] = dict() if int(dType[-1:]) not in drop_table[pTable["TypeID"]]: drop_table[pTable["TypeID"]][int(dType[-1:])] = dict() drops = pTable[dType].replace("(", "").replace(")", "").split(';') for drop in drops: itemAttrs = drop.split(" ") iId = None for attr in itemAttrs: fullAttr = attr.split(":")
def start(): """docstring for start""" db.reset() do_poll()
# -*- coding: utf-8 -*- import code import readline import rlcompleter from {{ cookiecutter.repo_name}} import app from {{ cookiecutter.repo_name}} import db app.ready(web=False, worker=False) try: exports = {'db': db} readline.set_completer(rlcompleter.Completer(exports).complete) readline.parse_and_bind("tab: complete") shell = code.InteractiveConsole(exports) shell.interact() finally: db.reset()
def reset(): db = get_db() db.reset() return redirect(url_for('index'))