当前位置: 首页>>代码示例>>Python>>正文


Python utils.whoami函数代码示例

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


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


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