;ò
ÎÑAHc           @   sb   d  Z  d k Z e i i ƒ  Z d k Z d Z d e i f d „  ƒ  YZ	 e d „ Z
 e d „ Z d S(   s–   Simple TCP socket server that executes statements in IPython instance.

Usage:

import ipy_server
ipy_server.serve_thread(16455)

Now, to execute the statements in this ipython instance, open a TCP socket
(port 16455), write out the statements, and close the socket. 
You can use e.g. "telnet localhost 16455" or a script to do this.

This is a bit like 'M-x server-start" or gnuserv in the emacs world.

Ni£  s   IPythonRequestHandlerc           B   s   t  Z d „  Z RS(   Nc         C   s,   |  i i ƒ  i d d ƒ } t i | ƒ d  S(   Ns   
s   
(   s   selfs   rfiles   reads   replaces   inps   ips   runlines(   s   selfs   inp(    (    sN   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_server.pys   handle   s    (   s   __name__s
   __module__s   handle(    (    (    sN   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_server.pys   IPythonRequestHandler   s   c         C   s/   t  i d |  f t ƒ } d G|  GH| i ƒ  d  S(   Ns    s   ipy_server on TCP port(   s   SocketServers	   TCPServers   ports   IPythonRequestHandlers   servers   serve_forever(   s   ports   server(    (    sN   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_server.pys   serve   s    	c         C   s    d  k  } | i t |  f ƒ d  S(   N(   s   threads   start_new_threads   serves   port(   s   ports   thread(    (    sN   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_server.pys   serve_thread$   s    	(   s   __doc__s   IPython.ipapis   IPythons   ipapis   gets   ips   SocketServers   PORTs   StreamRequestHandlers   IPythonRequestHandlers   serves   serve_thread(   s   serve_threads   SocketServers   ips   serves   IPythonRequestHandlers   IPythons   PORT(    (    sN   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_server.pys   ?   s   		