def __init__(self):
    self.is_on_pi = is_on_pi()
    self.__init_db__()
    self.bus_stops = []
    if read_bustime_data_from_disk:
      self.session_errors = [] #only for testing :)

    if self.is_on_pi:
      import RPi.GPIO as GPIO
      GPIO.setmode(GPIO.BCM)
      logging.debug("am running on a Raspberry Pi")

    self.__init_stops__()
    self.__cycle_lights__()
    self.__init_ticker__()
from operator import attrgetter

from sqlalchemy import Column, ForeignKey, Integer, String, Text
from sqlalchemy import orm

# from sqlalchemy import create_engine
from terminal_colors import green_code, red_code, yellow_code, blue_code, end_color

import logging  # magically the same as the one in bigappleserialbus.py

# write_bustime_responses_for_debug = False
from onpi import is_on_pi

write_bustime_responses_for_debug = False  # is_on_pi()

read_bustime_data_from_disk = (not is_on_pi()) and len(
    os.listdir(os.path.join(os.path.dirname(__file__), "..", "debugjson"))
) > 65


time_to_get_ready = 240  # seconds
time_to_go = 180  # seconds
seconds_to_sidewalk = 60  # seconds

green_notice = green_code + "[green]" + end_color + " "
red_notice = red_code + "[red]" + end_color + " "
fail_notice = yellow_code + "[FAIL]" + end_color + " "
remove_notice = blue_code + "[removed]" + end_color + " "
apikey_path = os.path.join(os.path.dirname(__file__), "..", "apikey.txt")
mta_api_key = open(apikey_path, "r").read().strip()
#!/usr/bin/env python

__author__ = 'Jeremy B. Merrill'
__email__ = '*****@*****.**'
__license__ = 'Apache'
__version__ = '0.1'

from onpi import is_on_pi
import logging
LOG_FILENAME = '/tmp/buses.log'
if is_on_pi():
  try:
    logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
  except IOError:
    logging.basicConfig(level=logging.DEBUG) #stdout
else:
  logging.basicConfig(level=logging.DEBUG) #stdout

from operator import itemgetter
import time
from busstop import BusStop, read_bustime_data_from_disk
import yaml
import os
from ticker import Ticker
import traceback

from terminal_colors import green_code, red_code, yellow_code, blue_code, end_color

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base