Module Expr Str Import alias Import alias Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias Assign NameStore ListLoad Str ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str While NameLoad body TryExcept body Assign TupleStore NameStore NameStore NameStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareIs NameLoad NameLoad body Break Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call NameLoad NameLoad Call AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Str Expr Call NameLoad NameLoad Str decorator_list decorator_list Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Expr Call AttributeLoad AttributeLoad NameLoad attr attr TryFinally body Return Call NameLoad NameLoad NameLoad NameLoad finalbody Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body TryExcept body Return Call NameLoad NameLoad NameLoad NameLoad handlers ExceptHandler type AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr decorator_list Return NameLoad decorator_list ClassDef bases body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr BinOpSub Num Call NameLoad AttributeLoad NameLoad attr If CompareEq Call NameLoad NameLoad Num body If CompareNotEq Call NameLoad AttributeLoad NameLoad attr Num body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Return AugAssignAdd AttributeStore NameLoad attr NameLoad If CompareEq Call NameLoad AttributeLoad NameLoad attr Num body Assign TupleStore AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr If CompareLt AttributeLoad NameLoad attr Num body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr orelse If CompareEq AttributeLoad NameLoad attr Num body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr orelse Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assert CompareIn AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad If CompareEq AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr orelse If CompareEq AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr BinOpSub AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr If CompareEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Return AugAssignAdd AttributeStore NameLoad attr NameLoad If CompareEq Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assert CompareEq AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr If CompareEq NameLoad Call NameLoad AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr Num orelse Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Slice NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assert CompareEq AttributeLoad NameLoad attr NameLoad If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Return Assign AttributeStore NameLoad attr Str If CompareEq Call NameLoad NameLoad Num body Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr BinOpAdd Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Return CompareEq AttributeLoad NameLoad attr NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Return CompareIn AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Return CompareEq AttributeLoad NameLoad attr NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list ClassDef bases body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad Num body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr BoolOpOr NameLoad Call NameLoad Assign AttributeStore NameLoad attr BoolOpOr NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign TupleStore AttributeStore NameLoad attr AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assert UnaryOpNot AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr For NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListLoad Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore ListLoad For TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body If Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr If Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr If Call AttributeLoad NameLoad attr body Delete SubscriptDel AttributeLoad NameLoad attr Index NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assert AttributeLoad NameLoad attr Str Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr For NameStore NameLoad body If CompareEq NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num orelse If CompareEq NameLoad Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr body Assign NameStore AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr attr Assign SubscriptStore AttributeLoad NameLoad attr Index Call AttributeLoad NameLoad attr Call NameLoad NameLoad AttributeLoad NameLoad attr orelse Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Expr Call AttributeLoad NameLoad attr If CompareEq AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad AttributeLoad NameLoad attr NameLoad NameLoad NameLoad AttributeLoad NameLoad attr For NameStore NameLoad body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr For NameStore NameLoad body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr Delete SubscriptDel AttributeLoad NameLoad attr Index NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str For NameStore Call NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad NameLoad NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr While NameLoad body Expr Call AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A Implementation of non-blocking server.

The main idea of the server is reciving and sending requests
only from main thread.

It also makes thread pool server in tasks terms, not connections.
 N/A threading N/A socket N/A Queue N/A select N/A struct N/A logging thrift.transport TTransport thrift.protocol.TBinaryProtocol TBinaryProtocolFactory N/A __all__ N/A TNonblockingServer Worker N/A N/A threading Thread N/A N/A Worker is a small helper to process incoming connection. __init__ N/A N/A self queue N/A N/A N/A N/A N/A N/A threading Thread __init__ self N/A N/A self queue queue N/A run N/A N/A self N/A N/A N/A Process queries from task queue, stop if processor is None. N/A True N/A N/A N/A N/A N/A processor iprot oprot otrans callback N/A N/A N/A self queue get N/A N/A processor None N/A N/A N/A N/A N/A processor process iprot oprot N/A N/A callback True N/A N/A otrans getvalue N/A N/A N/A Exception N/A N/A N/A N/A logging exception Exception while processing request N/A N/A callback False N/A N/A N/A WAIT_LEN 0 N/A WAIT_MESSAGE 1 N/A WAIT_PROCESS 2 N/A SEND_ANSWER 3 N/A CLOSED 4 locked N/A N/A func N/A N/A N/A Decorator which locks self.lock. nested N/A N/A self N/A args kwargs N/A N/A N/A N/A N/A self lock acquire N/A N/A N/A N/A func self args kwargs N/A N/A N/A N/A N/A self lock release N/A N/A nested N/A socket_exception N/A N/A func N/A N/A N/A Decorator close object on socket.error. read N/A N/A self N/A args kwargs N/A N/A N/A N/A N/A func self args kwargs N/A N/A N/A N/A socket error N/A N/A N/A N/A self close N/A N/A read N/A Connection N/A N/A N/A Basic class is represented connection.
    
    It can be in state:
        WAIT_LEN --- connection is reading request len.
        WAIT_MESSAGE --- connection is reading request.
        WAIT_PROCESS --- connection has just read whole request and 
            waits for call ready routine.
        SEND_ANSWER --- connection is sending answer string (including length
            of answer).
        CLOSED --- socket was closed and connection should be deleted.
     __init__ N/A N/A self new_socket wake_up N/A N/A N/A N/A self socket new_socket N/A N/A N/A N/A self socket setblocking False N/A N/A self status WAIT_LEN N/A N/A self len 0 N/A N/A self message N/A N/A self lock N/A N/A threading Lock N/A N/A self wake_up wake_up N/A _read_len N/A N/A self N/A N/A N/A Reads length of request.
        
        It's really paranoic routine and it may be replaced by 
        self.socket.recv(4). N/A read N/A N/A N/A self socket recv N/A 4 N/A len N/A self message N/A N/A N/A len read 0 N/A N/A N/A N/A len N/A self message 0 N/A N/A N/A N/A logging error can't read frame size from socket N/A N/A N/A self close N/A N/A N/A self message read N/A N/A N/A len N/A self message 4 N/A N/A N/A N/A self len N/A N/A struct unpack !i N/A self message N/A N/A N/A self len 0 N/A N/A N/A N/A logging error negative frame size, it seems client doesn't use FramedTransport N/A N/A N/A self close N/A N/A N/A N/A self len 0 N/A N/A N/A N/A logging error empty frame, it's really strange N/A N/A N/A self close N/A N/A N/A self message N/A N/A self status WAIT_MESSAGE N/A read N/A N/A self N/A N/A N/A Reads data from stream and switch state. N/A N/A N/A self status N/A WAIT_LEN WAIT_MESSAGE N/A N/A N/A self status WAIT_LEN N/A N/A N/A N/A self _read_len N/A N/A N/A N/A self status WAIT_MESSAGE N/A N/A read N/A N/A N/A self socket recv N/A N/A self len N/A len N/A self message N/A N/A N/A len read 0 N/A N/A N/A N/A logging error N/A can't read frame from socket (get %d of %d bytes) N/A N/A len N/A self message N/A self len N/A N/A N/A self close N/A N/A N/A self message read N/A N/A N/A len N/A self message N/A self len N/A N/A N/A self status WAIT_PROCESS N/A socket_exception write N/A N/A self N/A N/A N/A Writes data from socket and switch state. N/A N/A N/A self status SEND_ANSWER N/A sent N/A N/A N/A self socket send N/A self message N/A N/A sent N/A len N/A self message N/A N/A N/A self status WAIT_LEN N/A N/A self message N/A N/A self len 0 N/A N/A N/A self message N/A N/A self message N/A sent N/A socket_exception ready N/A N/A self all_ok message N/A N/A N/A Callback function for switching state and waking up main thread.
        
        This function is the only function witch can be called asynchronous.
        
        The ready can switch Connection to three states:
            WAIT_LEN if request was oneway.
            SEND_ANSWER if request was processed in normal way.
            CLOSED if request throws unexpected exception.
        
        The one wakes up main thread.
         N/A N/A N/A self status WAIT_PROCESS N/A N/A all_ok N/A N/A N/A N/A self close N/A N/A N/A self wake_up N/A N/A N/A self len N/A N/A N/A len message 0 N/A N/A N/A self message N/A N/A self status WAIT_LEN N/A N/A N/A self message N/A N/A N/A struct pack !i N/A len message message N/A N/A self status SEND_ANSWER N/A N/A N/A self wake_up N/A locked is_writeable N/A N/A self N/A N/A N/A Returns True if connection should be added to write list of select. N/A N/A N/A self status SEND_ANSWER N/A locked is_readable N/A N/A self N/A N/A N/A Returns True if connection should be added to read list of select. N/A N/A N/A self status N/A WAIT_LEN WAIT_MESSAGE N/A locked is_closed N/A N/A self N/A N/A N/A Returns True if connection is closed. N/A N/A N/A self status CLOSED N/A locked fileno N/A N/A self N/A N/A N/A Returns the file descriptor of the associated socket. N/A N/A N/A N/A self socket fileno N/A close N/A N/A self N/A N/A N/A Closes connection N/A N/A self status CLOSED N/A N/A N/A N/A self socket close N/A N/A TNonblockingServer N/A N/A N/A Non-blocking server. __init__ N/A N/A self processor lsocket inputProtocolFactory outputProtocolFactory threads N/A None None 10 N/A N/A N/A self processor processor N/A N/A self socket lsocket N/A N/A self in_protocol N/A inputProtocolFactory N/A TBinaryProtocolFactory N/A N/A self out_protocol N/A outputProtocolFactory N/A self in_protocol N/A N/A self threads N/A int threads N/A N/A self clients N/A N/A N/A self tasks N/A N/A Queue Queue N/A N/A N/A self _read N/A self _write N/A N/A socket socketpair N/A N/A self prepared False N/A setNumThreads N/A N/A self num N/A N/A N/A Set the number of worker threads that should be created. N/A N/A N/A self prepared You can't change number of threads for working server N/A N/A self threads num N/A prepare N/A N/A self N/A N/A N/A Prepares server for serve requests. N/A N/A N/A N/A self socket listen N/A _ N/A xrange N/A self threads N/A N/A thread N/A Worker N/A self tasks N/A N/A N/A thread setDaemon True N/A N/A N/A thread start N/A N/A self prepared True N/A wake_up N/A N/A self N/A N/A N/A Wake up main thread.
        
        The server usualy waits in select call in we should terminate one.
        The simplest way is using socketpair.
        
        Select always wait to read from the first socket of socketpair.
        
        In this case, we can just write anything to the second socket from
        socketpair. N/A N/A N/A N/A self _write send 1 N/A _select N/A N/A self N/A N/A N/A Does select on open connections. N/A readable N/A N/A N/A N/A N/A self socket handle fileno N/A N/A N/A self _read fileno N/A writable N/A N/A N/A i connection N/A N/A N/A self clients items N/A N/A N/A N/A connection is_readable N/A N/A N/A N/A readable append N/A N/A connection fileno N/A N/A N/A connection is_writeable N/A N/A N/A N/A writable append N/A N/A connection fileno N/A N/A N/A connection is_closed N/A N/A N/A N/A self clients N/A i N/A N/A N/A select select readable writable readable N/A handle N/A N/A self N/A N/A N/A Handle requests.
       
        WARNING! You must call prepare BEFORE calling handle.
         N/A N/A self prepared You have to call prepare before handle N/A N/A rset wset xset N/A N/A self _select N/A readable rset N/A N/A N/A readable N/A N/A N/A self _read fileno N/A N/A N/A N/A N/A self _read recv 1024 N/A N/A N/A readable N/A N/A N/A N/A self socket handle fileno N/A N/A client N/A N/A N/A N/A self socket accept handle N/A N/A N/A self clients N/A N/A N/A client fileno N/A Connection client N/A self wake_up N/A N/A connection N/A N/A self clients N/A readable N/A N/A N/A connection read N/A N/A N/A connection status WAIT_PROCESS N/A N/A itransport N/A N/A TTransport TMemoryBuffer N/A connection message N/A otransport N/A N/A TTransport TMemoryBuffer N/A iprot N/A N/A N/A self in_protocol getProtocol itransport N/A oprot N/A N/A N/A self out_protocol getProtocol otransport N/A N/A N/A N/A self tasks put N/A N/A self processor iprot oprot otransport N/A connection ready N/A writeable wset N/A N/A N/A N/A N/A N/A self clients N/A writeable write N/A oob xset N/A N/A N/A N/A N/A N/A self clients N/A oob close N/A N/A N/A self clients N/A oob N/A close N/A N/A self N/A N/A N/A Closes the server. N/A _ N/A xrange N/A self threads N/A N/A N/A N/A N/A self tasks put N/A None None None None None N/A N/A N/A N/A self socket close N/A N/A self prepared False N/A serve N/A N/A self N/A N/A N/A Serve forever. N/A N/A N/A self prepare N/A True N/A N/A N/A N/A self handle N/A N/A