# Path: py_arduino_web/pyroproxy/utils.py
# class BasePyroMain(object):
#     """
#     Base class to create scrpits from `pyroproxy.cli.*`
#     """
# 
#     logger = logging.getLogger('BasePyroMain')
# 
#     def __init__(self):
#         self.parser = optparse.OptionParser()
#         self.add_options()
# 
#     def add_options(self):
#         self.parser.add_option("--debug",
#             action="store_true", dest="debug", default=False,
#             help="Configure logging to show debug messages.")
#         self.parser.add_option("--info",
#             action="store_true", dest="info", default=False,
#             help="Configure logging to show info messages.")
#         self.parser.add_option("--dont-check-pyro-server",
#             action="store_true", dest="dont_check_pyro_server", default=False,
#             help="Don't check if PyRO server is reachable (by default, "
#             "a check is done and we exit if the server isn't reachable.)")
#         self.parser.add_option("--wait-until-connected",
#             action="store_true", dest="wait_until_pyro_server_is_up", default=False,
#             help="Wait until the PyRO server is up")
# 
#     def run(self, options, args, arduino):
#         """
#         To be overriden in subclass.
#         Do not call this method directly! You must call `start()`.
#         """
#         raise(NotImplementedError())
# 
#     def start(self):
#         (options, args) = self.parser.parse_args()
# 
#         # setup logging
#         if options.debug:
#             logging.basicConfig(level=logging.DEBUG)
#         elif options.info:
#             logging.basicConfig(level=logging.INFO)
#         else:
#             logging.basicConfig(level=logging.ERROR)
# 
#         if not options.dont_check_pyro_server:
#             if not server_is_up():
#                 print "ERROR: PyRO server isn't reachable"
#                 sys.exit(1)
# 
#         if options.wait_until_pyro_server_is_up:
#             wait_for_server()
# 
#         arduino = get_arduino_pyro()
#         try:
#             return self.run(options, args, arduino)
#         except KeyboardInterrupt:
#             print ""
#             return None
#         except Exception:
#             raise


from IPython.frontend.terminal.embed import InteractiveShellEmbed
from IPython.core.prompts import PromptManager
from py_arduino_web.pyroproxy.utils import BasePyroMain
##    py-arduino is distributed in the hope that it will be useful,
##    but WITHOUT ANY WARRANTY; without even the implied warranty of
##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##    GNU General Public License version 2 for more details.
##
##    You should have received a copy of the GNU General Public License
##    along with py-arduino; see the file LICENSE.txt.
##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-




banner = """

----------------------------------------------------------------------
py-arduino
----------------------------------------------------------------------

Launching IPython shell... Enter 'quit()' to exit.

Available variables:
    - arduino: the PyArduino instance.

Example:
    >>> arduino.ping()
    'PING_OK'
 
"""



# Path: py_arduino_web/pyroproxy/utils.py
# class BasePyroMain(object):
#     """
#     Base class to create scrpits from `pyroproxy.cli.*`
#     """
# 
#     logger = logging.getLogger('BasePyroMain')
# 
#     def __init__(self):
#         self.parser = optparse.OptionParser()
#         self.add_options()
# 
#     def add_options(self):
#         self.parser.add_option("--debug",
#             action="store_true", dest="debug", default=False,
#             help="Configure logging to show debug messages.")
#         self.parser.add_option("--info",
#             action="store_true", dest="info", default=False,
#             help="Configure logging to show info messages.")
#         self.parser.add_option("--dont-check-pyro-server",
#             action="store_true", dest="dont_check_pyro_server", default=False,
#             help="Don't check if PyRO server is reachable (by default, "
#             "a check is done and we exit if the server isn't reachable.)")
#         self.parser.add_option("--wait-until-connected",
#             action="store_true", dest="wait_until_pyro_server_is_up", default=False,
#             help="Wait until the PyRO server is up")
# 
#     def run(self, options, args, arduino):
#         """
#         To be overriden in subclass.
#         Do not call this method directly! You must call `start()`.
#         """
#         raise(NotImplementedError())
# 
#     def start(self):
#         (options, args) = self.parser.parse_args()
# 
#         # setup logging
#         if options.debug:
#             logging.basicConfig(level=logging.DEBUG)
#         elif options.info:
#             logging.basicConfig(level=logging.INFO)
#         else:
#             logging.basicConfig(level=logging.ERROR)
# 
#         if not options.dont_check_pyro_server:
#             if not server_is_up():
#                 print "ERROR: PyRO server isn't reachable"
#                 sys.exit(1)
# 
#         if options.wait_until_pyro_server_is_up:
#             wait_for_server()
# 
#         arduino = get_arduino_pyro()
#         try:
#             return self.run(options, args, arduino)
#         except KeyboardInterrupt:
#             print ""
#             return None
#         except Exception:
#             raise


# Path: py_arduino_web/pyroproxy/cli/ipython.py
from IPython.frontend.terminal.embed import InteractiveShellEmbed
from IPython.core.prompts import PromptManager
from py_arduino_web.pyroproxy.utils import BasePyroMain

##    py-arduino is distributed in the hope that it will be useful,
##    but WITHOUT ANY WARRANTY; without even the implied warranty of
##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##    GNU General Public License version 2 for more details.
##
##    You should have received a copy of the GNU General Public License
##    along with py-arduino; see the file LICENSE.txt.
##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-




banner = """

----------------------------------------------------------------------
py-arduino
----------------------------------------------------------------------

Launching IPython shell... Enter 'quit()' to exit.

Available variables:
    - arduino: the PyArduino instance.

Example:
    >>> arduino.ping()
    'PING_OK'
 
"""



class Main(BasePyroMain):