예제 #1
0
    def __init__(self, db_connection):

        # Function Description: Intialise the Event_Driver. Inherits from Driver.
        # Function Parameters: db_connection (pymysql.connections.Connection: The connection to the database.)
        # Function Throws: Nothing
        # Function Returns: Nothing

        Driver.__init__(self, db_connection)  # Send the parameters up.
예제 #2
0
    def __init__(self, db_connection):

        # Function Description: Intialise the Game_Driver. The Game_Driver will handle all the function related to a Game:
        #       1. Insert a new instance of a Game.
        # Paramters: db_connection (pymysql.connections.Connection: The connection to the database.)
        # Function Throws: Nothing
        # Function Returns: Nothing

        Driver.__init__(self, db_connection)
예제 #3
0
    def __init__(self, db_connection, max_size=1000):

        # Class Description: The function will manage all the individual batch queues. Note: The key identifying each Batch_Queue
        #    must match each table name.
        # Class Parameters: db_connection (The existing connection to the database.),
        #    max_size (The point where we insert all the queues into the database.)

        Driver.__init__(self, db_connection)
        self.max_size = max_size
        self.queues = {}
        self.current_size = 0  # Manage the size of the queue. Empty the queue when it gets to large.
예제 #4
0
    def __init__(self, db_connection):

        # Class Description: The class will manage and control the data insertions into the baseball database. Note, 
        #   the class does not perform any queries. The queries are delegated to the specific drivers.

        Driver.__init__(self, db_connection)                                                          # The path to the pymysql connector to access the database.
        self.path_to_raw_data = Path("BaseballAnalytics/bin/db/raw_data/")                            # The path to the raw data that will be inserted into the database.
        self.path_to_player_list = self.path_to_raw_data / 'rosters'                                  # The folder containing the player data.
        self.path_to_pickle_player_data = self.path_to_player_list / 'pickle_player_data.pickle'      # The path to the pickle file containing the player information. 
        self.log_folder = Path('BaseballAnalytics/logs/insert_file_logs/')                            # The path to the log file.
        self.path_to_raw_data = Path('C:/Users/micha/Desktop/')
        self.log_file = self.__initiate_log_file(self.log_folder)
예제 #5
0
    def __init__(self, id, num, ser):
        Driver.__init__(self, id)
        self.ser = ser
        self.num = num

        if os.path.isfile("persist/"+str(self.id)):
            f = open("persist/"+str(self.id), "rb")
            self.setParameters(pickle.load(f))
            f.close()
        else: 
            self.status = 0
            self.setStatus(self.status)
예제 #6
0
    def __init__(self, id, id1, id2, q):
        Driver.__init__(self, id)
        self.id1 = id1
        self.id2 = id2
        self.q = q.queue
        q.start()

        if os.path.isfile("persist/"+str(self.id)):
            f = open("persist/"+str(self.id), "rb")
            self.setParameters(pickle.load(f))
            f.close()
        else: 
            self.status = 0
            self.brightness = 100
            self.mode = 1 # 1=temp, 0=color
            self.color = 0
            self.temp = 100
            self.setStatus(self.status)
            self.apply()