MCPcopy Index your code
hub / github.com/webpy/webpy / sorted_items

Method sorted_items

web/utils.py:266–276  ·  view source on GitHub ↗

Returns items sorted by value. >>> c = counter() >>> c.add('x') >>> c.add('x') >>> c.add('y') >>> c.sorted_items() [('x', 2), ('y', 1)]

(self)

Source from the content-addressed store, hash-verified

264 return [self[k] for k in self.sorted_keys()]
265
266 def sorted_items(self):
267 """Returns items sorted by value.
268
269 >>> c = counter()
270 >>> c.add('x')
271 >>> c.add('x')
272 >>> c.add('y')
273 >>> c.sorted_items()
274 [('x', 2), ('y', 1)]
275 """
276 return [(k, self[k]) for k in self.sorted_keys()]
277
278 def __repr__(self):
279 return "<Counter " + dict.__repr__(self) + ">"

Callers

nothing calls this directly

Calls 1

sorted_keysMethod · 0.95

Tested by

no test coverage detected