def __init__(self, api_key): ''' Initialize the system with a valid WMATA API key ''' self.api = WMATA(api_key) # Initialize the rail lines: self.rail_lines = [] for line in LINES: for direction in [True, False]: self.rail_lines.append( RailLine(self.api, line, reverse=direction))
def __init__(self, api_key, database=':memory:'): ''' Initialize the system with a valid WMATA API key ''' self.api = WMATA(api_key) self.current_time = "" self.database = sqlite3.connect(database) #Check to see if the Stations table exists: namesResults = self.database.execute( "SELECT name FROM SQLITE_MASTER").fetchall() names = [name[0] for name in namesResults] if "Stations" in names: self.loadStations() # Initialize the rail lines: self.rail_lines = [] for line in LINES: for direction in [True, False]: self.rail_lines.append( RailLine(self.api, line, reverse=direction))