diff --git a/heapq/heapq.py b/heapq/heapq.py index e43254f6..8b278fb8 100644 --- a/heapq/heapq.py +++ b/heapq/heapq.py @@ -127,7 +127,7 @@ From all times, sorting has always been a Great Art! :-) __all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'merge', 'nlargest', 'nsmallest', 'heappushpop'] -from itertools import islice, count, tee, chain +#from itertools import count, tee, chain def heappush(heap, item): """Push item onto heap, maintaining the heap invariant.""" @@ -197,6 +197,7 @@ def nlargest(n, iterable): Equivalent to: sorted(iterable, reverse=True)[:n] """ + from itertools import islice, count, tee, chain if n < 0: return [] it = iter(iterable) @@ -215,6 +216,7 @@ def nsmallest(n, iterable): Equivalent to: sorted(iterable)[:n] """ + from itertools import islice, count, tee, chain if n < 0: return [] it = iter(iterable) @@ -392,6 +394,7 @@ def nsmallest(n, iterable, key=None): Equivalent to: sorted(iterable, key=key)[:n] """ + from itertools import islice, count, tee, chain # Short-cut for n==1 is to use min() when len(iterable)>0 if n == 1: it = iter(iterable) @@ -430,6 +433,7 @@ def nlargest(n, iterable, key=None): Equivalent to: sorted(iterable, key=key, reverse=True)[:n] """ + from itertools import islice, count, tee, chain # Short-cut for n==1 is to use max() when len(iterable)>0 if n == 1: it = iter(iterable) diff --git a/heapq/metadata.txt b/heapq/metadata.txt index 84d67faa..56874652 100644 --- a/heapq/metadata.txt +++ b/heapq/metadata.txt @@ -1,5 +1,5 @@ srctype = cpython type = module -version = 0.9.1 +version = 0.9.2 # Module uses in *some* functions, but we don't want to depend on it #depends = itertools diff --git a/heapq/setup.py b/heapq/setup.py index 5f526d45..446c1610 100644 --- a/heapq/setup.py +++ b/heapq/setup.py @@ -6,7 +6,7 @@ from setuptools import setup setup(name='micropython-heapq', - version='0.9.1', + version='0.9.2', description='CPython heapq module ported to MicroPython', long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.', url='https://github.com/micropython/micropython/issues/405',