Python psyco 模块,bind() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用psyco.bind()

项目:5In1RowService    作者:caiwb    | 项目源码 | 文件源码
def startup(self, port = 0, host = ''):
        self.shutdown()
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        try: self.sock.bind((host, port))
        except: 
            try: self.sock.close()
            except: pass
            return -1
        try: self.sock.listen(65536)
        except:
            try: self.sock.close()
            except: pass
            return -1
        self.sock.setblocking(0)
        self.port = self.sock.getsockname()[1]
        self.state = 1
        self.host = host
        self.timeslap = long(time.time() * 1000)
        return 0

    # shutdown service
项目:collection    作者:skywind3000    | 项目源码 | 文件源码
def _psyco_speedup():
    try:
        import psyco
        psyco.bind(preprocessor)
        psyco.bind(configure)
        psyco.bind(coremake)
        psyco.bind(emake)
        #print 'full optimaze'
    except:
        return False
    return True



#----------------------------------------------------------------------
# distribution
#----------------------------------------------------------------------
项目:5In1RowService    作者:caiwb    | 项目源码 | 文件源码
def _psyco_speedup():
    try:
        import psyco
        psyco.bind(rc4crypt)
        psyco.bind(netstream)
        psyco.bind(nethost)
        psyco.bind(CCLIB)
    except:
        return False
    return True
项目:collection    作者:skywind3000    | 项目源码 | 文件源码
def psyco_speedup ():
    try:
        import psyco
        psyco.bind(chessboard)
        psyco.bind(evaluation)
    except:
        pass
    return 0
项目:collection    作者:skywind3000    | 项目源码 | 文件源码
def speedup():
    try:
        import psyco
        psyco.bind(disjointset)
        psyco.bind(vector2d)
        psyco.bind(line2d)
        psyco.bind(savebmp)
    except ImportError:
        pass