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


Python Queue._put方法代码示例

本文整理汇总了Python中queue.Queue._put方法的典型用法代码示例。如果您正苦于以下问题:Python Queue._put方法的具体用法?Python Queue._put怎么用?Python Queue._put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在queue.Queue的用法示例。


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

示例1: _put

# 需要导入模块: from queue import Queue [as 别名]
# 或者: from queue.Queue import _put [as 别名]
    def _put(self, xxx_todo_changeme):
        # Only consider re-evaluation if we are still on the same eval
        # session.
        (eval_sess, is_reeval) = xxx_todo_changeme
        if is_reeval and self._curr_eval_sess is not eval_sess:
            return

        replace = True
        if hasattr(eval_sess, "ctlr") and eval_sess.ctlr and eval_sess.ctlr.keep_existing:
            # Allow multiple eval sessions; currently used for variable
            # highlighting (bug 80095), may pick up additional uses.  Note that
            # these sessions can still get wiped out by a single replace=False
            # caller.
            replace = False

        if replace:
            # We only allow *one* eval session at a time.
            # - Drop a possible accumulated eval session.
            if len(self.queue):
                self.queue.clear()
            ## - Abort the current eval session.
            if not is_reeval and self._curr_eval_sess is not None:
                self._curr_eval_sess.ctlr.abort()

        # Lazily start the eval thread.
        if not self.isAlive():
            self.start()

        Queue._put(self, (eval_sess, is_reeval))
        if replace:
            assert len(self.queue) == 1
开发者ID:AlexStef,项目名称:stef-sublime-conf,代码行数:33,代码来源:manager.py

示例2: matrix_bfs

# 需要导入模块: from queue import Queue [as 别名]
# 或者: from queue.Queue import _put [as 别名]
def matrix_bfs(initialState):
    # initialize datastructures
    knownSet = dict()
    toBeVisited = Queue()


    # give the algorithm initial parameters
    knownSet[initialState.__hash__()] = 1
    toBeVisited._put(initialState)

    while not(toBeVisited.empty()):
        global count
        count += 1
        #remove a state from the front of the queue
        curState = toBeVisited.get()
        global endPos
        if not(curState.curPosition.__eq__(endPos)):
            knownSet[curState.__hash__()] = 1



        #check to see if it's the final state, if so flag, break, and print
        if(is_final_state(curState)):
            global bfs_complete_flag
            bfs_complete_flag = 1
            break

        #curState.__repr__()
        #print(curState.curPosition.row, curState.curPosition.column)
        #print()

        #get the curState's neighbors, and queue them up if they haven't been visited yet
        for adj in curState.get_adjacent_states():
            if not(adj.__hash__ in knownSet):
                toBeVisited.put(adj)
开发者ID:emcenrue,项目名称:ProgrammingTeam,代码行数:37,代码来源:CF301_Ice_Cave.py

示例3: Bot

# 需要导入模块: from queue import Queue [as 别名]
# 或者: from queue.Queue import _put [as 别名]
class Bot(object):
    
    def __init__(self, me, job):
        self.targets = Queue()
        self.me = me
        self.position = 1
        pushes = job.split()
        for i in range(len(pushes)):
            if pushes[i] == me: self.targets._put(pushes[i+1])
    
    def move(self, who):
        if self.targets.empty(): return False
        target = int(self.targets.queue[0])        
        if self.position == target:            
            if self.me == who:
                self.targets.get()
                return True
        elif self.position < target:
            self.position += 1
        else: 
            self.position -= 1
        
        return False
开发者ID:hgasimov,项目名称:Google-Code-Jam,代码行数:25,代码来源:BotTrust.py

示例4: _put

# 需要导入模块: from queue import Queue [as 别名]
# 或者: from queue.Queue import _put [as 别名]
 def _put(self, item):
     if item not in self.all_items:
         Queue._put(self, item) 
         self.all_items.add(item)
开发者ID:adalmieres,项目名称:scriptsIBMConnections,代码行数:6,代码来源:IBMConnectionsProfileTags.py

示例5: _put

# 需要导入模块: from queue import Queue [as 别名]
# 或者: from queue.Queue import _put [as 别名]
    def _put(self, item):

        Queue._put(self, item)
        self.sort()
开发者ID:AljGaber,项目名称:imp,代码行数:6,代码来源:utils.py


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