Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: third_party/logilab/common/tasksqueue.py

Issue 719313003: Revert "pylint: upgrade to 1.3.1" (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/logilab/common/table.py ('k') | third_party/logilab/common/testlib.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. 1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr 2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
3 # 3 #
4 # This file is part of logilab-common. 4 # This file is part of logilab-common.
5 # 5 #
6 # logilab-common is free software: you can redistribute it and/or modify it unde r 6 # logilab-common is free software: you can redistribute it and/or modify it unde r
7 # the terms of the GNU Lesser General Public License as published by the Free 7 # the terms of the GNU Lesser General Public License as published by the Free
8 # Software Foundation, either version 2.1 of the License, or (at your option) an y 8 # Software Foundation, either version 2.1 of the License, or (at your option) an y
9 # later version. 9 # later version.
10 # 10 #
11 # logilab-common is distributed in the hope that it will be useful, but WITHOUT 11 # logilab-common is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 # details. 14 # details.
15 # 15 #
16 # You should have received a copy of the GNU Lesser General Public License along 16 # You should have received a copy of the GNU Lesser General Public License along
17 # with logilab-common. If not, see <http://www.gnu.org/licenses/>. 17 # with logilab-common. If not, see <http://www.gnu.org/licenses/>.
18 """Prioritized tasks queue""" 18 """Prioritized tasks queue"""
19 19
20 __docformat__ = "restructuredtext en" 20 __docformat__ = "restructuredtext en"
21 21
22 from bisect import insort_left 22 from bisect import insort_left
23 23 from Queue import Queue
24 from six.moves import queue
25 24
26 LOW = 0 25 LOW = 0
27 MEDIUM = 10 26 MEDIUM = 10
28 HIGH = 100 27 HIGH = 100
29 28
30 PRIORITY = { 29 PRIORITY = {
31 'LOW': LOW, 30 'LOW': LOW,
32 'MEDIUM': MEDIUM, 31 'MEDIUM': MEDIUM,
33 'HIGH': HIGH, 32 'HIGH': HIGH,
34 } 33 }
35 REVERSE_PRIORITY = dict((values, key) for key, values in PRIORITY.items()) 34 REVERSE_PRIORITY = dict((values, key) for key, values in PRIORITY.iteritems())
36 35
37 36
38 37
39 class PrioritizedTasksQueue(queue.Queue): 38 class PrioritizedTasksQueue(Queue):
40 39
41 def _init(self, maxsize): 40 def _init(self, maxsize):
42 """Initialize the queue representation""" 41 """Initialize the queue representation"""
43 self.maxsize = maxsize 42 self.maxsize = maxsize
44 # ordered list of task, from the lowest to the highest priority 43 # ordered list of task, from the lowest to the highest priority
45 self.queue = [] 44 self.queue = []
46 45
47 def _put(self, item): 46 def _put(self, item):
48 """Put a new item in the queue""" 47 """Put a new item in the queue"""
49 for i, task in enumerate(self.queue): 48 for i, task in enumerate(self.queue):
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 87
89 def __cmp__(self, other): 88 def __cmp__(self, other):
90 return cmp(self.priority, other.priority) 89 return cmp(self.priority, other.priority)
91 90
92 def __lt__(self, other): 91 def __lt__(self, other):
93 return self.priority < other.priority 92 return self.priority < other.priority
94 93
95 def __eq__(self, other): 94 def __eq__(self, other):
96 return self.id == other.id 95 return self.id == other.id
97 96
98 __hash__ = object.__hash__
99
100 def merge(self, other): 97 def merge(self, other):
101 pass 98 pass
OLDNEW
« no previous file with comments | « third_party/logilab/common/table.py ('k') | third_party/logilab/common/testlib.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698