OLD | NEW |
1 # Unmodified from http://code.activestate.com/recipes/576693/ | 1 # Unmodified from http://code.activestate.com/recipes/576693/ |
| 2 # other than to add MIT license header (as specified on page, but not in code). |
2 # Linked from Python documentation here: | 3 # Linked from Python documentation here: |
3 # http://docs.python.org/2/library/collections.html#collections.OrderedDict | 4 # http://docs.python.org/2/library/collections.html#collections.OrderedDict |
4 # | 5 # |
5 # This should be deleted once Py2.7 is available on all bots, see | 6 # This should be deleted once Py2.7 is available on all bots, see |
6 # http://crbug.com/241769. | 7 # http://crbug.com/241769. |
| 8 # |
| 9 # Copyright (c) 2009 Raymond Hettinger. |
| 10 # |
| 11 # Permission is hereby granted, free of charge, to any person obtaining a copy |
| 12 # of this software and associated documentation files (the "Software"), to deal |
| 13 # in the Software without restriction, including without limitation the rights |
| 14 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 15 # copies of the Software, and to permit persons to whom the Software is |
| 16 # furnished to do so, subject to the following conditions: |
| 17 # |
| 18 # The above copyright notice and this permission notice shall be included in |
| 19 # all copies or substantial portions of the Software. |
| 20 # |
| 21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 22 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 23 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 24 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 25 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 26 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 27 # THE SOFTWARE. |
7 | 28 |
8 # Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pyp
y. | 29 # Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pyp
y. |
9 # Passes Python2.7's test suite and incorporates all the latest updates. | 30 # Passes Python2.7's test suite and incorporates all the latest updates. |
10 | 31 |
11 try: | 32 try: |
12 from thread import get_ident as _get_ident | 33 from thread import get_ident as _get_ident |
13 except ImportError: | 34 except ImportError: |
14 from dummy_thread import get_ident as _get_ident | 35 from dummy_thread import get_ident as _get_ident |
15 | 36 |
16 try: | 37 try: |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 return KeysView(self) | 278 return KeysView(self) |
258 | 279 |
259 def viewvalues(self): | 280 def viewvalues(self): |
260 "od.viewvalues() -> an object providing a view on od's values" | 281 "od.viewvalues() -> an object providing a view on od's values" |
261 return ValuesView(self) | 282 return ValuesView(self) |
262 | 283 |
263 def viewitems(self): | 284 def viewitems(self): |
264 "od.viewitems() -> a set-like object providing a view on od's items" | 285 "od.viewitems() -> a set-like object providing a view on od's items" |
265 return ItemsView(self) | 286 return ItemsView(self) |
266 | 287 |
OLD | NEW |