parallel: Add missing annotation.

This commit is contained in:
Tim Abbott 2016-07-29 16:02:48 -07:00
parent d00719f204
commit d7d8d6b4d2
1 changed files with 2 additions and 0 deletions

View File

@ -12,6 +12,7 @@ def run_parallel(job, data, threads=6):
pids = {} # type: Dict[int, Any] pids = {} # type: Dict[int, Any]
def wait_for_one(): def wait_for_one():
# type: () -> Tuple[int, Any]
while True: while True:
try: try:
(pid, status) = os.wait() (pid, status) = os.wait()
@ -58,6 +59,7 @@ if __name__ == "__main__":
jobs = [10, 19, 18, 6, 14, 12, 8, 2, 1, 13, 3, 17, 9, 11, 5, 16, 7, 15, 4] jobs = [10, 19, 18, 6, 14, 12, 8, 2, 1, 13, 3, 17, 9, 11, 5, 16, 7, 15, 4]
expected_output = [6, 10, 12, 2, 1, 14, 8, 3, 18, 19, 5, 9, 13, 11, 4, 7, 17, 16, 15] expected_output = [6, 10, 12, 2, 1, 14, 8, 3, 18, 19, 5, 9, 13, 11, 4, 7, 17, 16, 15]
def wait_and_print(x): def wait_and_print(x):
# type: (int) -> int
time.sleep(x * 0.1) time.sleep(x * 0.1)
return 0 return 0