OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import collections | 5 import collections |
6 import operator | 6 import operator |
7 | 7 |
8 | 8 |
9 def freeze(obj): | 9 def freeze(obj): |
10 """Takes a generic object ``obj``, and returns an immutable version of it. | 10 """Takes a generic object ``obj``, and returns an immutable version of it. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 return len(self._d) | 74 return len(self._d) |
75 | 75 |
76 def __getitem__(self, key): | 76 def __getitem__(self, key): |
77 return self._d[key] | 77 return self._d[key] |
78 | 78 |
79 def __hash__(self): | 79 def __hash__(self): |
80 return self._hash | 80 return self._hash |
81 | 81 |
82 def __repr__(self): | 82 def __repr__(self): |
83 return 'FrozenDict(%r)' % (self._d.items(),) | 83 return 'FrozenDict(%r)' % (self._d.items(),) |
OLD | NEW |