black formatting

This commit is contained in:
Roland Thomas Jr 2024-05-12 22:42:11 -04:00
parent d528285828
commit 11f98d078f
Signed by: roland
GPG Key ID: 7C3C2B085A4C2872
5 changed files with 11 additions and 6 deletions

View File

@ -6,7 +6,7 @@ from concurrent.futures import ThreadPoolExecutor, as_completed
def add_one(number): def add_one(number):
print(number) print(number)
sleep(randint(0,2)) sleep(randint(0, 2))
return number + 1 return number + 1

View File

@ -6,8 +6,9 @@ from concurrent.futures import ThreadPoolExecutor, Future
results: list[int] = [] results: list[int] = []
def add_one(number: int) -> int: def add_one(number: int) -> int:
sleep(randint(0,2)) sleep(randint(0, 2))
result = number + 1 result = number + 1
return result return result

View File

@ -6,7 +6,7 @@ from concurrent.futures import ThreadPoolExecutor
def add_one(number): def add_one(number):
print(number) print(number)
sleep(randint(0,2)) sleep(randint(0, 2))
return number + 1 return number + 1

View File

@ -5,8 +5,9 @@ from concurrent.futures import ThreadPoolExecutor, Future, wait, FIRST_COMPLETED
results: list[int] = [] results: list[int] = []
def add_one(number: int) -> int: def add_one(number: int) -> int:
sleep(randint(0,2)) sleep(randint(0, 2))
return number + 1 return number + 1

View File

@ -5,9 +5,10 @@ from concurrent.futures import ThreadPoolExecutor, wait, Future
results: list[int] = [] results: list[int] = []
def add_one(number: int) -> int: def add_one(number: int) -> int:
print(number) print(number)
sleep(randint(0,2)) sleep(randint(0, 2))
return number + 1 return number + 1
@ -28,7 +29,9 @@ def main() -> None:
print("All done!") print("All done!")
with ThreadPoolExecutor() as executor: 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!") print("Done waiting!")
for future in futures: for future in futures:
print(future.result()) print(future.result())