diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e67db7808ba475564e18702878fdd5dd22b8589..0c221fca72f2246c3b78eadcf6ed3b440f1391bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v2.0.12 + +* Pomniejsze usprawnienia do TimerHeap ## v2.0.11 diff --git a/satella/coding/structures.py b/satella/coding/structures.py index 4a55e7c95d0a341db98ccf0c51cedbac88fda798..be65187b04e12dbf94cfc45e1d7b9360c4d9dad1 100644 --- a/satella/coding/structures.py +++ b/satella/coding/structures.py @@ -227,6 +227,11 @@ class TimeBasedHeap(Heap): def __repr__(self): return u'<satella.coding.TimeBasedHeap>' + @returns_iterable + def items(self): + """Return an iterator, but WITHOUT timestamps (only items), in unspecified order""" + return (ts, ob for ts, ob in self.heap) + def __init__(self): """ Initialize an empty heap diff --git a/setup.py b/setup.py index 95ce08f2381315ba2f4ead8f639d5fe971003e83..846f98fe05bb0cf9df0c478ca7515bb827b9f41d 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup(name='satella', - version='2.0.11', + version='2.0.12dev1', description=u'Utilities for writing servers in Python', author=u'Piotr MaĹlanka', author_email='piotrm@smok.co', diff --git a/tests/test_coding/test_structures.py b/tests/test_coding/test_structures.py index 6bc4eb1392a186a78eef8493e73e61c5c85e751e..ab2b9b64865c750f46b4eea2627405cdb7e8dbcc 100644 --- a/tests/test_coding/test_structures.py +++ b/tests/test_coding/test_structures.py @@ -21,6 +21,12 @@ class TestTimeBasedHeap(unittest.TestCase): self.assertNotIn((30, 'kota'), q) + def test_imprv(self): + tbh = TimeBasedHeap() + tbh.put(10, 'ala') + + self.assertIn('ala', list(tbh.items())) + class TestHeap(unittest.TestCase): def test_push(self):