black formatting
This commit is contained in:
parent
d528285828
commit
11f98d078f
|
@ -6,6 +6,7 @@ from concurrent.futures import ThreadPoolExecutor, Future
|
|||
|
||||
results: list[int] = []
|
||||
|
||||
|
||||
def add_one(number: int) -> int:
|
||||
sleep(randint(0, 2))
|
||||
result = number + 1
|
||||
|
|
|
@ -5,6 +5,7 @@ from concurrent.futures import ThreadPoolExecutor, Future, wait, FIRST_COMPLETED
|
|||
|
||||
results: list[int] = []
|
||||
|
||||
|
||||
def add_one(number: int) -> int:
|
||||
sleep(randint(0, 2))
|
||||
return number + 1
|
||||
|
|
|
@ -5,6 +5,7 @@ from concurrent.futures import ThreadPoolExecutor, wait, Future
|
|||
|
||||
results: list[int] = []
|
||||
|
||||
|
||||
def add_one(number: int) -> int:
|
||||
print(number)
|
||||
sleep(randint(0, 2))
|
||||
|
@ -28,7 +29,9 @@ def main() -> None:
|
|||
print("All done!")
|
||||
|
||||
with ThreadPoolExecutor() as executor:
|
||||
futures: list[Future] = [executor.submit(add_one, number) for number in range(10)]
|
||||
futures: list[Future] = [
|
||||
executor.submit(add_one, number) for number in range(10)
|
||||
]
|
||||
print("Done waiting!")
|
||||
for future in futures:
|
||||
print(future.result())
|
||||
|
|
Loading…
Reference in New Issue