This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
from multiprocessing import Process, cpu_count, Queue | |
def pmap(func, items, func_args=(), func_kwargs={}, n_workers=cpu_count()): | |
"""Maps the function "func" to each item in "items" in parallel using | |
threads. | |
:param callable func: A callable that takes "array" as a first positional | |
argument and returns an array that is the same size the input "array". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def split_path(path): | |
"""split a path fully into its components | |
:param path: input path string | |
:return: list of the split path | |
.. todo:: see how to use generators with the yield statement | |
.. todo:: to replace the while loop | |
.. code-block:: python |
NewerOlder