Skip to content

Commit d4e6c36

Browse files
authored
Remove TODOs for issues 200/201 (temporalio#69)
* remove TODOs for issues 200/201 * lint fix
1 parent 4ef3a37 commit d4e6c36

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

hello/hello_activity_choice.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,33 +58,31 @@ async def run(self, list: ShoppingList) -> str:
5858
# Order each thing on the list
5959
ordered: List[str] = []
6060
for item in list.items:
61-
# TODO(cretz): Use "is" instead of "==" after
62-
# https://github.com/temporalio/sdk-python/issues/200 is fixed
63-
if item.fruit == Fruit.APPLE:
61+
if item.fruit is Fruit.APPLE:
6462
ordered.append(
6563
await workflow.execute_activity(
6664
order_apples,
6765
item.amount,
6866
start_to_close_timeout=timedelta(seconds=5),
6967
)
7068
)
71-
elif item.fruit == Fruit.BANANA:
69+
elif item.fruit is Fruit.BANANA:
7270
ordered.append(
7371
await workflow.execute_activity(
7472
order_bananas,
7573
item.amount,
7674
start_to_close_timeout=timedelta(seconds=5),
7775
)
7876
)
79-
elif item.fruit == Fruit.CHERRY:
77+
elif item.fruit is Fruit.CHERRY:
8078
ordered.append(
8179
await workflow.execute_activity(
8280
order_cherries,
8381
item.amount,
8482
start_to_close_timeout=timedelta(seconds=5),
8583
)
8684
)
87-
elif item.fruit == Fruit.ORANGE:
85+
elif item.fruit is Fruit.ORANGE:
8886
ordered.append(
8987
await workflow.execute_activity(
9088
order_oranges,

hello/hello_activity_multiprocess.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
import multiprocessing
33
import os
44
import time
5+
from concurrent.futures import ProcessPoolExecutor
56
from dataclasses import dataclass
67
from datetime import timedelta
78

89
from temporalio import activity, workflow
910
from temporalio.client import Client
1011
from temporalio.worker import SharedStateManager, Worker
1112

12-
# TODO(cretz): https://github.com/temporalio/sdk-python/issues/201
13-
with workflow.unsafe.sandbox_unrestricted():
14-
from concurrent.futures import ProcessPoolExecutor
15-
1613

1714
@dataclass
1815
class ComposeGreetingInput:

hello/hello_activity_threaded.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import asyncio
22
import threading
33
import time
4+
from concurrent.futures import ThreadPoolExecutor
45
from dataclasses import dataclass
56
from datetime import timedelta
67

78
from temporalio import activity, workflow
89
from temporalio.client import Client
910
from temporalio.worker import Worker
1011

11-
# TODO(cretz): https://github.com/temporalio/sdk-python/issues/201
12-
with workflow.unsafe.sandbox_unrestricted():
13-
from concurrent.futures import ThreadPoolExecutor
14-
1512

1613
@dataclass
1714
class ComposeGreetingInput:

0 commit comments

Comments
 (0)