Skip to content

Commit

Permalink
fix: some lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsawatzky committed Aug 25, 2023
1 parent c75b4e5 commit 7419980
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,28 @@ class ExceptionToStatusInterceptor(ServerInterceptor):
def intercept(
self,
method: Callable,
request: Any,
request_or_iterator: Any,
context: grpc.ServicerContext,
method_name: str,
) -> Any:
"""Override this method to implement a custom interceptor.
You should call method(request, context) to invoke the
You should call method(request_or_iterator, context) to invoke the
next handler (either the RPC method implementation, or the
next interceptor in the list).
Args:
method: The next interceptor, or method implementation.
request: The RPC request, as a protobuf message.
request_or_iterator: The RPC request, as a protobuf message.
context: The ServicerContext pass by gRPC to the service.
method_name: A string of the form
"/protobuf.package.Service/Method"
Returns:
This should generally return the result of
method(request, context), which is typically the RPC
method(request_or_iterator, context), which is typically the RPC
method response, as a protobuf message. The interceptor
is free to modify this in some way, however.
"""
try:
return method(request, context)
return method(request_or_iterator, context)
except GrpcException as e:
context.set_code(e.status_code)
context.set_details(e.details)
Expand Down
10 changes: 5 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,31 +77,31 @@ To define your own server interceptor (we can use a simplified version of
def intercept(
self,
method: Callable,
request: Any,
request_or_iterator: Any,
context: grpc.ServicerContext,
method_name: str,
) -> Any:
"""Override this method to implement a custom interceptor.
You should call method(request, context) to invoke the
You should call method(request_or_iterator, context) to invoke the
next handler (either the RPC method implementation, or the
next interceptor in the list).
Args:
method: The next interceptor, or method implementation.
request: The RPC request, as a protobuf message.
request_or_iterator: The RPC request, as a protobuf message.
context: The ServicerContext pass by gRPC to the service.
method_name: A string of the form
"/protobuf.package.Service/Method"
Returns:
This should generally return the result of
method(request, context), which is typically the RPC
method(request_or_iterator, context), which is typically the RPC
method response, as a protobuf message. The interceptor
is free to modify this in some way, however.
"""
try:
return method(request, context)
return method(request_or_iterator, context)
except GrpcException as e:
context.set_code(e.status_code)
context.set_details(e.details)
Expand Down
10 changes: 5 additions & 5 deletions src/grpc_interceptor/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def intercept(
) -> Any: # pragma: no cover
"""Override this method to implement a custom interceptor.
You should call method(request, context) to invoke the next handler (either the
RPC method implementation, or the next interceptor in the list).
You should call method(request_or_iterator, context) to invoke the next handler
(either the RPC method implementation, or the next interceptor in the list).
Args:
method: Either the RPC method implementation, or the next interceptor in
Expand All @@ -37,7 +37,7 @@ def intercept(
method_name: A string of the form "/protobuf.package.Service/Method"
Returns:
This should generally return the result of method(request, context), which
This should return the result of method(request, context), which
is typically the RPC method response, as a protobuf message, or an
iterator of protobuf messages for streaming responses. The interceptor is
free to modify this in some way, however.
Expand Down Expand Up @@ -90,7 +90,7 @@ async def intercept(
) -> Any: # pragma: no cover
"""Override this method to implement a custom interceptor.
You should call await method(request_or_iterator, context) to invoke the next handler
You should await method(request_or_iterator, context) to invoke the next handler
(either the RPC method implementation, or the next interceptor in the list).
Args:
Expand All @@ -103,7 +103,7 @@ async def intercept(
method_name: A string of the form "/protobuf.package.Service/Method"
Returns:
This should generally return the result of await method(request_or_iterator, context),
This should return the result of method(request_or_iterator, context),
which is typically the RPC method response, as a protobuf message. The
interceptor is free to modify this in some way, however.
"""
Expand Down

0 comments on commit 7419980

Please sign in to comment.