remote.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:pslab-desktop-apps 作者: fossasia 项目源码 文件源码
def GET(self, id=None):
        if id == None:
            return('Here are all the functions available: %s' % self.functions)

        fn_name=id.split('(')[0]
        args=str(id.split('(')[1]).split(',')

        if len(args):args[-1]=args[-1][:-1]
        total_args=[]
        for t in args:
            print (t,len(t))
            if t[0]=="'" or t[0]=='"':total_args.append(t[1:-1])
            else:total_args.append(string.atoi(t))

        method = self.methods.get(fn_name)[0]
        if method == None :
            print ('no such command :',fn_name)
            return 'no such command : %s'%fn_name
        else:
            print (method,total_args)
            #while self.hw_lock and self.active: pass
            #self.hw_lock=True
            result=method(*total_args)      
            #self.hw_lock=False
            return json.dumps(result,cls=NumpyEncoder)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号