Skip to content

Commit 0841df4

Browse files
committed
Standardize executable empty blocks
Use pass for executable no-op bodies while retaining ellipses for overload and Protocol declarations. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 52a9a819-4e52-467d-9a9f-d862280a94c0
1 parent 50f62e2 commit 0841df4

5 files changed

Lines changed: 36 additions & 36 deletions

File tree

azure-functions-durable/azure/durable_functions/internal/compat/token_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self):
1818
@abstractmethod
1919
def to_json(self) -> dict[str, str]:
2020
"""Convert this token source into a JSON-serializable dictionary."""
21-
...
21+
pass
2222

2323

2424
class ManagedIdentityTokenSource(TokenSource):

durabletask/payload/store.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class PayloadStore(abc.ABC):
4141
@abc.abstractmethod
4242
def options(self) -> LargePayloadStorageOptions:
4343
"""Return the storage options for this payload store."""
44-
...
44+
pass
4545

4646
@abc.abstractmethod
4747
def upload(self, data: bytes, *, instance_id: str | None = None) -> str:
@@ -59,12 +59,12 @@ def upload(self, data: bytes, *, instance_id: str | None = None) -> str:
5959
Returns:
6060
A token string that can be used to retrieve the payload.
6161
"""
62-
...
62+
pass
6363

6464
@abc.abstractmethod
6565
async def upload_async(self, data: bytes, *, instance_id: str | None = None) -> str:
6666
"""Async version of :meth:`upload`."""
67-
...
67+
pass
6868

6969
@abc.abstractmethod
7070
def download(self, token: str) -> bytes:
@@ -77,14 +77,14 @@ def download(self, token: str) -> bytes:
7777
Returns:
7878
The original payload bytes.
7979
"""
80-
...
80+
pass
8181

8282
@abc.abstractmethod
8383
async def download_async(self, token: str) -> bytes:
8484
"""Async version of :meth:`download`."""
85-
...
85+
pass
8686

8787
@abc.abstractmethod
8888
def is_known_token(self, value: str) -> bool:
8989
"""Return ``True`` if *value* looks like a token produced by this store."""
90-
...
90+
pass

durabletask/serialization.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class DataConverter(ABC):
6868
@abstractmethod
6969
def serialize(self, value: Any) -> str | None:
7070
"""Serialize ``value`` to a string, or ``None`` when ``value`` is ``None``."""
71-
...
71+
pass
7272

7373
@abstractmethod
7474
def deserialize(self, data: str | None, target_type: type | None = None) -> Any:
@@ -85,7 +85,7 @@ def deserialize(self, data: str | None, target_type: type | None = None) -> Any:
8585
:class:`JsonDataConverter` is best-effort and falls back; a validating
8686
converter may instead raise.
8787
"""
88-
...
88+
pass
8989

9090
@abstractmethod
9191
def coerce(self, value: Any, target_type: type | None = None) -> Any:
@@ -99,7 +99,7 @@ def coerce(self, value: Any, target_type: type | None = None) -> Any:
9999
(strict vs. best-effort) that an implementation applies in
100100
:meth:`deserialize` should apply here.
101101
"""
102-
...
102+
pass
103103

104104
def can_reconstruct(self, target_type: Any) -> bool:
105105
"""Return True if this converter can rebuild ``target_type`` from a payload.

tests/durabletask/test_orchestration_executor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ class Result:
586586
message: str
587587

588588
def annotated_activity(ctx, _) -> Result:
589-
...
589+
pass
590590

591591
captured: dict = {}
592592

@@ -626,7 +626,7 @@ class Override:
626626
value: str
627627

628628
def annotated_activity(ctx, _) -> Annotated:
629-
...
629+
pass
630630

631631
captured: dict = {}
632632

tests/durabletask/test_type_discovery.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def can_reconstruct(self, target_type: Any) -> bool:
107107
return super().can_reconstruct(target_type)
108108

109109
def act(ctx, w: Widget):
110-
...
110+
pass
111111

112112
# The default converter does not recognize Widget...
113113
assert type_discovery.activity_input_type(act) is None
@@ -118,48 +118,48 @@ def act(ctx, w: Widget):
118118
class TestInputTypeDiscovery:
119119
def test_orchestrator_input_type_dataclass(self):
120120
def orch(ctx, order: Order):
121-
...
121+
pass
122122
assert type_discovery.orchestrator_input_type(orch) is Order
123123

124124
def test_activity_input_type_dataclass(self):
125125
def act(ctx, order: Order):
126-
...
126+
pass
127127
assert type_discovery.activity_input_type(act) is Order
128128

129129
def test_input_type_builtin_returns_none(self):
130130
def act(ctx, value: int):
131-
...
131+
pass
132132
assert type_discovery.activity_input_type(act) is None
133133

134134
def test_input_type_unannotated_returns_none(self):
135135
def act(ctx, value):
136-
...
136+
pass
137137
assert type_discovery.activity_input_type(act) is None
138138

139139
def test_input_type_no_input_param_returns_none(self):
140140
def orch(ctx):
141-
...
141+
pass
142142
assert type_discovery.orchestrator_input_type(orch) is None
143143

144144
def test_postponed_annotation_resolves(self):
145145
# Annotation provided as a string (PEP 563 style) still resolves because
146146
# Order is importable in this module's globals.
147147
def act(ctx, order: "Order"):
148-
...
148+
pass
149149
assert type_discovery.activity_input_type(act) is Order
150150

151151
def test_function_entity_input_type(self):
152152
def counter(ctx, order: Order):
153-
...
153+
pass
154154
assert type_discovery.entity_input_type(counter, "any_op") is Order
155155

156156
def test_class_entity_input_type_per_operation(self):
157157
class Store(entities.DurableEntity):
158158
def add(self, order: Order):
159-
...
159+
pass
160160

161161
def clear(self):
162-
...
162+
pass
163163

164164
assert type_discovery.entity_input_type(Store, "add") is Order
165165
# Operation with no input parameter.
@@ -171,32 +171,32 @@ def clear(self):
171171
class TestActivityOutputTypeDiscovery:
172172
def test_dataclass_return_annotation(self):
173173
def act(ctx, _) -> Order:
174-
...
174+
pass
175175
assert type_discovery.activity_output_type(act) is Order
176176

177177
def test_from_json_return_annotation(self):
178178
def act(ctx, _) -> Money:
179-
...
179+
pass
180180
assert type_discovery.activity_output_type(act) is Money
181181

182182
def test_builtin_return_annotation_returns_none(self):
183183
def act(ctx, _) -> int:
184-
...
184+
pass
185185
assert type_discovery.activity_output_type(act) is None
186186

187187
def test_unannotated_return_returns_none(self):
188188
def act(ctx, _):
189-
...
189+
pass
190190
assert type_discovery.activity_output_type(act) is None
191191

192192
def test_optional_dataclass_return(self):
193193
def act(ctx, _) -> Optional[Order]:
194-
...
194+
pass
195195
assert type_discovery.activity_output_type(act) is Optional[Order]
196196

197197
def test_postponed_return_annotation_resolves(self):
198198
def act(ctx, _) -> "Order":
199-
...
199+
pass
200200
assert type_discovery.activity_output_type(act) is Order
201201

202202
def test_string_name_returns_none(self):
@@ -223,7 +223,7 @@ class TestSignatureCaching:
223223

224224
def test_signature_inspected_once_per_function(self):
225225
def act(ctx, order: Order) -> Money:
226-
...
226+
pass
227227

228228
real_signature = inspect.signature
229229
calls: list[Any] = []
@@ -248,7 +248,7 @@ def counting_signature(obj, *args, **kwargs):
248248
def test_entity_operation_signature_inspected_once(self):
249249
class Store(entities.DurableEntity):
250250
def add(self, order: Order):
251-
...
251+
pass
252252

253253
real_signature = inspect.signature
254254
calls: list[Any] = []
@@ -277,7 +277,7 @@ def can_reconstruct(self, target_type: Any) -> bool:
277277
return super().can_reconstruct(target_type)
278278

279279
def act(ctx, w: Widget) -> Widget:
280-
...
280+
pass
281281

282282
# Prime the cache with the converter that *does* recognize Widget, then
283283
# switch back: the cached structure must not bake in the first answer.
@@ -303,7 +303,7 @@ def can_reconstruct(self, target_type: Any) -> bool:
303303
return super().can_reconstruct(target_type)
304304

305305
def act(ctx, w: Widget):
306-
...
306+
pass
307307

308308
converter = ToggleConverter()
309309
assert type_discovery.activity_input_type(act, converter) is None
@@ -314,7 +314,7 @@ def act(ctx, w: Widget):
314314

315315
def test_converter_is_consulted_on_every_call(self):
316316
def act(ctx, order: Order) -> Order:
317-
...
317+
pass
318318

319319
converter = _CountingConverter()
320320
for _ in range(3):
@@ -328,7 +328,7 @@ def act(ctx, order: Order) -> Order:
328328

329329
def test_unannotated_parameters_are_not_offered_to_the_converter(self):
330330
def act(ctx, value, *args, keyword_only: Order = None, **kwargs):
331-
...
331+
pass
332332

333333
converter = _CountingConverter()
334334
assert type_discovery.activity_input_type(act, converter) is None
@@ -344,7 +344,7 @@ def __eq__(self, other):
344344
return self is other
345345

346346
def __call__(self, ctx, order: Order) -> Order:
347-
...
347+
pass
348348

349349
act = Callable_()
350350
assert type_discovery.activity_input_type(act) is Order
@@ -361,7 +361,7 @@ class ConfiguredActivity:
361361
retries: int = 3
362362

363363
def __call__(self, ctx, order: Order) -> Order:
364-
...
364+
pass
365365

366366
handler = ConfiguredActivity()
367367
with pytest.raises(TypeError):

0 commit comments

Comments
 (0)