• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.whoami函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utils.whoami函数的典型用法代码示例。如果您正苦于以下问题:Python whoami函数的具体用法?Python whoami怎么用?Python whoami使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了whoami函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: parseAction_coordinator_start

def parseAction_coordinator_start(token):
    if runtime.DEBUG_MODE & runtime.OBJ_TRIGGER:
        print utils.whoami(), token
    #probably useless test... otherwise the token would not be matched and we would not be here
    if len(token) >= 2: # only "processAgent" and the name of the agent
        ag = Coordinator(token[1])
    
    #if no inheritance
    if len(token) == 2:
        ag.total = runtime.core.getNextTotal()


    if len(token) == 3:
        # If just making a deepcopy, we copy everything, including the __childrenAgents attribute,
        # which is huge and useless (and wrong I think...). The memory grows exponentially,
        # and the parsing is stuck. So we save the __childrenAgents attribute of the mother,
        # empty it, copy the mother, and put it back to her
        motherChildren = runtime.core.getCoordinator(token[2]).getChildrenAgents()
        runtime.core.getCoordinator(token[2]).setChildrenAgents({})
        ag = copy.deepcopy(runtime.core.getCoordinator(token[2]))
        runtime.core.getCoordinator(token[2]).setChildrenAgents(motherChildren)
        
        ag.setMotherAgent(runtime.core.getCoordinator(token[2]), token[1])
        
    runtime.core.addCoordinator(ag)
开发者ID:C-fire,项目名称:Phronesis,代码行数:25,代码来源:coordinatorParser.py


示例2: recursiveRename

 def recursiveRename(self, newName):
     if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
         print utils.whoami()
         print utils.whataremyargs()
     
     self.__envAgent.agentName = newName + '_env'
     self.__envAgent.recursiveRename(newName)
开发者ID:C-fire,项目名称:Phronesis,代码行数:7,代码来源:serverParser.py


示例3: setMotherAgent

    def setMotherAgent(self, mother, realName):

#        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
#            print utils.whoami()
#            print utils.whataremyargs()
#
#        self.agentName = realName
#        self.__realName = realName
#        #if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
#        #    print self.agentName, " inherits from ", mother.agentName
#        self.__motherAgent = mother
#        mother.__childrenAgents[self.agentName] = self
#
#
#        self.recursiveRename('_' + self.agentName)
#        self.__envAgent.server = self.agentName
#        self.__envAgent.getFstab().server = self.agentName
#

        #More recent system, but with a flaw
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            print utils.whataremyargs()
        
        self.agentName = realName
        #if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
        #    print self.agentName, " inherits from ", mother.agentName
        self.__motherAgent = mother
        mother.__childrenAgents[self.agentName] = self
        self.recursiveRename(self.agentName)
        self.__envAgent.server = self.agentName
        self.__envAgent.getFstab().server = self.agentName
开发者ID:C-fire,项目名称:Phronesis,代码行数:32,代码来源:serverParser.py


示例4: assignNeeds

    def assignNeeds(self, needName, needValue):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            print utils.whataremyargs()
        
        # if there was already a need, writing on top of the needsAssignmentDic is not enough
        # we need to remove also the object in the process/file/folder/coord list
        print "needsAssignmentDic : %s"%self
        if ( needName in self.__needsAssignmentDic ):
            listFromWhichToDel = None
            agentToDel = self.__needsAssignmentDic[needName]
            print "STEP 1 agent to del : --%s--"%agentToDel
            if self.__needsDic[needName] == "Coordinator":
                listFromWhichToDel = self.__coordinatorList
            elif (self.__needsDic[needName] == "ProcessAgent"):
                listFromWhichToDel = self.__processAgentList
            elif self.__needsDic[needName] == "FileAgent":
                listFromWhichToDel = self.__fileAgentList
            elif self.__needsDic[needName] == "FolderAgent":
                listFromWhichToDel = self.__folderAgentList
            
            listFromWhichToDel.remove(agentToDel)

    
        self.__needsAssignmentDic[needName] = needValue
        if self.__needsDic[needName] == "Coordinator":
            self.__coordinatorList.append(needValue)
            if needValue.totalSet == False:
                needValue.total = self.__needsTotal[needName]    
        elif (self.__needsDic[needName] == "ProcessAgent"):
            self.__processAgentList.append(needValue)
        elif self.__needsDic[needName] == "FileAgent":
            self.__fileAgentList.append(needValue)
        elif self.__needsDic[needName] == "FolderAgent":
            self.__folderAgentList.append(needValue)
开发者ID:C-fire,项目名称:Phronesis,代码行数:35,代码来源:coordinatorParser.py


示例5: addAttachedCoordinator

    def addAttachedCoordinator(self, coord):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            print utils.whataremyargs()

        if coord not in self.attachedCoords:
            self.attachedCoords.append(coord)
开发者ID:C-fire,项目名称:Phronesis,代码行数:7,代码来源:serverParser.py


示例6: parseAction_setEnvDef

def parseAction_setEnvDef(token):
    if runtime.DEBUG_MODE & runtime.OBJ_TRIGGER:
        print utils.whoami(), token

    serverName = token[1]
    server = runtime.core.getServer(serverName)
    server.addAttribute(token[2], token[3])
开发者ID:C-fire,项目名称:Phronesis,代码行数:7,代码来源:serverParser.py


示例7: addAttachedCoordinatorName

    def addAttachedCoordinatorName(self, coordName):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            print utils.whataremyargs()

        self.attachedCoordNames.append(coordName)
        print "ATTACHED %s"%self.attachedCoordNames
开发者ID:C-fire,项目名称:Phronesis,代码行数:7,代码来源:serverParser.py


示例8: isFullyDefined

    def isFullyDefined(self):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD :
            print utils.whoami()

        if self.isFullyDefinedVal is None:
            self.isFullyDefinedVal = True
            if self.agentName is None:
                print "%s is not defined because agentName is not set" % self.agentName
                self.isFullyDefinedVal = False
            if self.filename is None:
                print "%s is not defined because filename is not set" % self.agentName
                self.isFullyDefinedVal = False
            if self.server is None:
                print "%s is not defined because server is not set" % self.agentName
                self.isFullyDefinedVal = False
                
            if len(self.variables): #if there are variables not assigned
                print "%s is not defined because of variables unassigned %s " % (self.agentName, self.variables)
                self.isFullyDefinedVal = False

            for t in self.triggers :
                if not t.isFullyDefined():
                    self.isFullyDefinedVal = False

        return self.isFullyDefinedVal
开发者ID:C-fire,项目名称:Phronesis,代码行数:25,代码来源:fileAgentParser.py


示例9: recursiveRename

    def recursiveRename(self, suffix):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            print utils.whataremyargs()
            
        for fa in self.__fileAgentList:
            #fa.agentName += suffix
            nn = self.getNeedName(fa)
            fa.recursiveRename(suffix)

        for fa in self.__folderAgentList:
            nn = self.getNeedName(fa)
            fa.recursiveRename(suffix)

        for pa in self.__processAgentList:
            nn = self.getNeedName(pa)
            #pa.agentName += suffix
            pa.recursiveRename(suffix)
        for co in self.__coordinatorList:
            #if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            #    print "I change name of ", co.agentName
            nn = self.getNeedName(co)
            co.__selfRename(suffix)
            co.recursiveRename("_" + nn + suffix)
            
        #experimental and probably not the good solution : 
        # rename also the destination of the triggers
        for fa in self.__fileAgentList:
            fa.renameTriggers(suffix)

        for fa in self.__folderAgentList:
            fa.renameTriggers(suffix)

        for pa in self.__processAgentList:
            pa.renameTriggers(suffix)
开发者ID:C-fire,项目名称:Phronesis,代码行数:35,代码来源:coordinatorParser.py


示例10: isFullyDefined

    def isFullyDefined(self):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            
        if self.__isFullyDefined is None :
            if len(self.__needsDic) == len(self.__needsAssignmentDic):
                self.__isFullyDefined = True
                #Now we have to check if all the tree is defined
                for needAssign in self.__needsAssignmentDic.values():
                    needDefined = needAssign.isFullyDefined()
                    print"I check for %s if fully defined because son %s " % (self.agentName, needAssign.agentName)
                    if not needDefined :
                        print  "%s Not fully defined because son %s not defined" % (self.agentName, needAssign.agentName)
                        self.__isFullyDefined = False
                        break  
            else:
                print "%s Not fully defined because len(self.__needsDic) != len(self.__needsAssignmentDic)" % (self.agentName)
                print self.__needsDic.keys()
                print self.__needsAssignmentDic.keys()
                self.__isFullyDefined = False             
        
            #if we are not fully defined, our children (not inherited classes, but children in teh tree) cannot be defined
            if not self.__isFullyDefined:
                for needAssign in self.__needsAssignmentDic.values():
                    print "I set isFullyDefined to False to %s" % needAssign.agentName
                    needAssign.setIsFullyDefined(False)

        return self.__isFullyDefined
开发者ID:C-fire,项目名称:Phronesis,代码行数:28,代码来源:coordinatorParser.py


示例11: setMotherAgent

    def setMotherAgent(self, mother, realName):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            print utils.whataremyargs()
        
        self.agentName = realName
        self.__realName = realName
        self.totalSet = True
        #if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
        #    print self.agentName, " inherits from ", mother.agentName
        self.__motherAgent = mother
        mother.__childrenAgents[self.agentName] = self


        #OLD SYSTEM, DOES NOT WORK BUT KEEP FOR RECORD
        #copy of the mother attributes
        #self.__variables = copy.deepcopy(mother.__variables)
        #self.__needsDic = copy.deepcopy(mother.__needsDic)
        
        #self.__needsAssignmentDic = copy.deepcopy(mother.__needsAssignmentDic )
        #self.__fileAgentList = copy.deepcopy(mother.__fileAgentList)
        #self.__processAgentList = copy.deepcopy(mother.__processAgentList)
        #self.__coordinatorList = copy.deepcopy(mother.__coordinatorList)

        #NEW METHOD, NOT SURE IF THIS WILL REALLY WORK...
        #realName = self.agentName
        #self = copy.deepcopy(mother)
        #self.agentName = realName


        self.recursiveRename('_' + self.agentName)
开发者ID:C-fire,项目名称:Phronesis,代码行数:31,代码来源:coordinatorParser.py


示例12: __init__

    def __init__(self, agentName):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            print utils.whataremyargs()

        fileAgentParser.FileAgent.__init__(self,agentName)
        self.maxDepth = 0
        self.filenameFilters = []
开发者ID:C-fire,项目名称:Phronesis,代码行数:8,代码来源:folderAgentParser.py


示例13: parse_action_file_content

def parse_action_file_content(token):
    if runtime.DEBUG_MODE & runtime.OBJ_TRIGGER:
        print utils.whoami(), token

    # I don't use runtime.core.currentFileAgent because
    # this function might be called by a folderAgent
    #runtime.core.currentFileAgent.addContent(token[1])
    runtime.core.currentMetaAgent.addContent(token[1])
开发者ID:C-fire,项目名称:Phronesis,代码行数:8,代码来源:fileAgentParser.py


示例14: parse_action_process_trigger

def parse_action_process_trigger(token):
    if runtime.DEBUG_MODE & runtime.OBJ_TRIGGER:
        print utils.whoami(), token
    # runtime.core.currentFileAgent.addTrigger((token[0], token[1], token[3], runtime.core.getEntity(token[5])))

    # Replace list by object
    # runtime.core.currentFileAgent.addTrigger([token[0], token[1], token[3], token[5]])
    runtime.core.currentProcessAgent.addTrigger(utils.Trigger(token[0], token[1], token[3], token[5]))
开发者ID:C-fire,项目名称:Phronesis,代码行数:8,代码来源:processAgentParser.py


示例15: setMotherAgent

    def setMotherAgent(self, mother):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD :
            print utils.whoami()
            print utils.whataremyargs()

        self.contents = copy.deepcopy(mother.contents)
        #self.envVarFile.agentName = 'babla'
        MetaAgent.setMotherAgent(self, mother)
开发者ID:C-fire,项目名称:Phronesis,代码行数:8,代码来源:fileAgentParser.py


示例16: __selfRename

    def __selfRename(self, suffix):
#        print "I rename myself (%s, %s) + %s -> %s" % (self.__realName, self.__suffix, suffix, self.__realName + suffix)
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            print utils.whataremyargs()

        self.__suffix = suffix
        self.agentName = self.__realName + suffix
开发者ID:C-fire,项目名称:Phronesis,代码行数:8,代码来源:coordinatorParser.py


示例17: removeAttachedCoordinatorName

    def removeAttachedCoordinatorName(self, coordName):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            print utils.whataremyargs()

        try:
            self.attachedCoordNames.remove(coordName)
        except:
            raise 'No Coordinator "%s" attached to server %s'%(coordName, self.agentName)
开发者ID:C-fire,项目名称:Phronesis,代码行数:9,代码来源:serverParser.py


示例18: setMotherAgent

    def setMotherAgent(self, mother):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            print utils.whataremyargs()

        self.envVarFile = copy.deepcopy(mother.envVarFile)
        # self.envVarFile.agentName = 'babla'
        self.envVarFile.recursiveRename(self.agentName)
        MetaAgent.setMotherAgent(self, mother)
开发者ID:C-fire,项目名称:Phronesis,代码行数:9,代码来源:processAgentParser.py


示例19: recursiveRename

    def recursiveRename(self, suffix):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            print utils.whataremyargs()

        MetaAgent.recursiveRename(self, suffix)
        if self.__childProcessAgent:
            self.__childProcessAgent.recursiveRename("_c_" + suffix)
        self.envVarFile.recursiveRename(suffix)
开发者ID:C-fire,项目名称:Phronesis,代码行数:9,代码来源:processAgentParser.py


示例20: assignVariable

    def assignVariable(self, varName, value):
        if runtime.DEBUG_MODE & runtime.OBJ_METHOD:
            print utils.whoami()
            print utils.whataremyargs()

        MetaAgent.assignVariable(self, varName, value)
        if self.__childProcessAgent:
            self.__childProcessAgent.assignVariable(varName, value)
        self.envVarFile.assignVariable(varName, value)
开发者ID:C-fire,项目名称:Phronesis,代码行数:9,代码来源:processAgentParser.py



注:本文中的utils.whoami函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.window函数代码示例发布时间:2022-05-26
下一篇:
Python utils.which函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap