Skip to content

Commit c4a85b7

Browse files
committed
Respond to upstream: {get,set}_operation_definition -> {get,set}_operation
1 parent a4df979 commit c4a85b7

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

temporalio/nexus/_decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ async def _start(
123123
return WorkflowRunOperationHandler(_start, input_type, output_type)
124124

125125
method_name = get_callable_name(start)
126-
nexusrpc.set_operation_definition(
126+
nexusrpc.set_operation(
127127
operation_handler_factory,
128128
nexusrpc.Operation(
129129
name=name or method_name,

temporalio/nexus/_util.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ def get_operation_factory(
129129
130130
``obj`` should be a decorated operation start method.
131131
"""
132-
op_defn = nexusrpc.get_operation_definition(obj)
133-
if op_defn:
132+
op = nexusrpc.get_operation(obj)
133+
if op:
134134
factory = obj
135135
else:
136136
if factory := getattr(obj, "__nexus_operation_factory__", None):
137-
op_defn = nexusrpc.get_operation_definition(factory)
138-
if not isinstance(op_defn, nexusrpc.Operation):
137+
op = nexusrpc.get_operation(factory)
138+
if not isinstance(op, nexusrpc.Operation):
139139
return None, None
140-
return factory, op_defn
140+
return factory, op
141141

142142

143143
# TODO(nexus-preview) Copied from nexusrpc

tests/nexus/test_dynamic_creation_of_user_handler_classes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ async def test_run_nexus_service_from_programmatically_created_service_handler(
7878
service_handler = nexusrpc.handler._core.ServiceHandler(
7979
service=nexusrpc.ServiceDefinition(
8080
name="MyService",
81-
operations={
82-
"increment": nexusrpc.Operation[int, int](
81+
operation_definitions={
82+
"increment": nexusrpc.OperationDefinition[int, int](
8383
name="increment",
8484
method_name="increment",
8585
input_type=int,

tests/nexus/test_handler.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -773,10 +773,7 @@ async def test_start_operation_without_type_annotations(
773773

774774

775775
def test_operation_without_type_annotations_without_service_definition_raises_validation_error():
776-
with pytest.raises(
777-
ValueError,
778-
match=r"has no input type.+has no output type",
779-
):
776+
with pytest.raises(ValueError, match=r"has no input type"):
780777
service_handler(MyServiceHandlerWithOperationsWithoutTypeAnnotations)
781778

782779

0 commit comments

Comments
 (0)