Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mjrosengrant committed Sep 8, 2023
1 parent 73536e7 commit 06cc51d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions nanome/beta/nanome_sdk/session/session_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ async def update_structures_deep(self, structures):
message_type = Messages.structures_deep_update
expects_response = True
args = structures
self._send_message(message_type, args, expects_response)
request_id = self._send_message(message_type, args, expects_response)
result = await self._process_payload(request_id)
return result

def update_structures_shallow(self, structures):
message_type = Messages.structures_shallow_update
expects_response = True
expects_response = False
args = structures
self._send_message(message_type, args, expects_response)

Expand All @@ -118,7 +120,7 @@ async def add_to_workspace(self, complex_list):
message_type = Messages.add_to_workspace
expects_response = True
args = complex_list
request_id = self._send_message(message_type, args, expects_response)
self._send_message(message_type, args, expects_response)

async def remove_from_workspace(self, complex_list):
"""By removing all atoms from complexes, we can remove them from the workspace."""
Expand Down
10 changes: 5 additions & 5 deletions nanome/beta/redis_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def request_complex_list(self):

def _send_message(self, message_type: Messages, fn_args, expects_response):
function_name = message_type.name
request_id, packet = self.build_packet(message_type, fn_args, expects_response)
message = self.build_message(function_name, request_id, packet, expects_response)
request_id, packet = self._build_packet(message_type, fn_args, expects_response)
message = self._build_message(function_name, request_id, packet, expects_response)
serialized_response = self._rpc_request(message, expects_response=expects_response)
if serialized_response is not None:
response = self._deserialize_payload(serialized_response)
Expand Down Expand Up @@ -203,11 +203,11 @@ def upload_shapes(self, shape_list):
def get_plugin_data(self):
function_name = 'get_plugin_data'
expects_response = True
message = self.build_message(function_name, None, None, expects_response)
message = self._build_message(function_name, None, None, expects_response)
response = self._rpc_request(message, expects_response=expects_response)
return response

def build_packet(self, message_type, args=None, expects_response=False):
def _build_packet(self, message_type, args=None, expects_response=False):
serializer = CommandMessageSerializer()
request_id = random_request_id()
message = serializer.serialize_message(request_id, message_type, args, self.version_table, expects_response)
Expand Down Expand Up @@ -259,7 +259,7 @@ def destroy_stream(self, stream):
self._send_message(message_type, args, expects_response)

@staticmethod
def build_message(function_name, request_id, packet=None, expects_response=False):
def _build_message(function_name, request_id, packet=None, expects_response=False):
response_channel = str(uuid.uuid4())
message = {
'function': function_name,
Expand Down

0 comments on commit 06cc51d

Please sign in to comment.