def main(args): db = database.Database(os.path.abspath('database.ini')) query = utils.read_query(args.query) plan = db.explain_query(query) if args.type == 'tree': tree = parser.build_tree(plan[0][0]["Plan"]) print(tree) elif args.type == 'vector': vector = parser.build_vector(plan[0][0]["Plan"]) print(vector) else: print("Invalid arguments. Run 'python main.py --help'") db.close()
def startSimulation(season, league, startingBudget, detailedStats): seasons = ["0910", "1011", "1112", "1213", "1314", "1415", "1516", "1617"] # leagues = ["E0", "D1", "I1", "SP1", "F1", "N1", "P1", "G1"] database = db.Database("localhost", "long-view", "afe", "1bellazio") deposit = int(season[-1]) % 2 depth = 2 threshold = 1.25 seasonForStrategy = seasons[seasons.index(season) - 1] strategy = st.WinnerStrategy(database, seasonForStrategy, league, depth, threshold) timer = t.Timer(database, season, league) portfolio = k.Kelly(startingBudget, detailedStats, deposit) while not timer.isEnded(): nextMatch = timer.nextMatch() bet = strategy.toBet(nextMatch) if bet != None: portfolio.calculate(bet) return portfolio
oooooooooo. oooooooooo. `888' `Y8b `888' `Y8b 888 888 888 888 888 888 888oooo888' 888 888 888 `88b 888 d88' 888 .88P o888bood8P' o888bood8P' ''' if __name__ == "__main__": print(ascii) # Initialize database and create cursors and connection my_db = database.Database() my_db.create_connection() my_db.create_cursors() # Initialize controller my_ctrl = controller.Controller(my_db) # Print options list option_list = '''What would you like to do? 1. Create database 2. Empty database 3. Load database 4. Reset database 5. Print ascii art 0. Exit '''
if __name__ == "__main__": parser = cmd.getArgumentParser() parser.add_argument('-song_id', type=int, required=True, help='Song ID containing beat') parser.add_argument('-beat_id', type=int, required=True, help='Beat ID to play') args = parser.parse_args() db = database.Database(host=args.dbhost, port=args.dbport, dbname=args.dbname, user=args.dbuser, password=args.dbpass) songs = db.getSongs(id=args.song_id) if 0 == songs: print("Not Found") exit(1) beats = songs[0].getBeats(id=args.beat_id) if 0 == beats: print("Not Found") exit(1) clip = io.BytesIO(beats[0].clip.tobytes()) segment = AudioSegment.from_file(clip, format=beats[0].format)
def __init__(self, host, db_name, user, port, password): self.db = database.Database(host=host, database=db_name, user=user, port=port, password=password)
def setUp(self): """Set up database""" self.dbName = 'testing' self.db = database.Database(self.dbName, ['tdd']) self.mongo = pymongo.MongoClient()
def __init__(self): self.commands = {"hi": self.hi, "quote": self.quote, "twss": self.twss} self._database = database.Database() self.value = 0
import json from src import FinalVariables from src import database import requests class GenreDetails: genres = [] def __init__(self, genres): self.genres = genres database = database.Database() conn = database.createConnection() database.createTables(conn) def fetch_genres(): api_url = 'https://api.themoviedb.org/3/genre/movie/list?api_key=' + FinalVariables.getAPIKey( ) + '&language=en-US' headers = {} response = requests.get(api_url, headers=headers) print(response) if response.status_code == 200: data = json.loads(response.content) GenreDetails(data) genres = data['genres'] for i in genres: database.input_genre(conn, i['id'], i['name']) else: