From 0966ea71570de5a51047601da63b35a230e6c424 Mon Sep 17 00:00:00 2001 From: virgilsisoe <28490646+sisoe24@users.noreply.github.com> Date: Mon, 25 Dec 2023 18:47:20 -0500 Subject: [PATCH] Update 'no_output' to 'no_reply' in received_data.py --- nukeserversocket/editor_controller.py | 2 +- nukeserversocket/received_data.py | 10 +++++----- tests/test_received_data.py | 18 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/nukeserversocket/editor_controller.py b/nukeserversocket/editor_controller.py index e4d37ad2..f7118496 100644 --- a/nukeserversocket/editor_controller.py +++ b/nukeserversocket/editor_controller.py @@ -117,7 +117,7 @@ def run(self, data: ReceivedData) -> str: if ( not self.settings.get('mirror_script_editor') or - data.no_output + data.no_reply ): LOGGER.debug('Restoring script editor.') self.input_editor.setPlainText(initial_input) diff --git a/nukeserversocket/received_data.py b/nukeserversocket/received_data.py index d8de364f..1c94d953 100644 --- a/nukeserversocket/received_data.py +++ b/nukeserversocket/received_data.py @@ -18,7 +18,7 @@ class ReceivedData: { "text": "Text to run in the script editor", "file": "File name to show in the output (optional))" - "no_output": "0" or "1" To disable output in the script editor (optional)" + "noReply": "0" or "1" To disable output in the script editor (optional)" } Raises: @@ -31,17 +31,17 @@ class ReceivedData: data: Dict[str, str] = field(init=False) file: str = field(init=False) text: str = field(init=False) - no_output: bool = field(init=False) + no_reply: bool = field(init=False) def __post_init__(self): try: self.data = json.loads(self.raw) self.data.setdefault('file', '') - self.data.setdefault('no_output', '0') + self.data.setdefault('noReply', '0') except Exception as e: LOGGER.error(f'An exception occurred while decoding the data. {e}') - self.data = {'text': '', 'file': '', 'no_output': '0'} + self.data = {'text': '', 'file': '', 'noReply': '0'} LOGGER.debug('Received data: %s', self.data) @@ -50,4 +50,4 @@ def __post_init__(self): LOGGER.critical('Data does not contain a text field.') self.file = self.data['file'] - self.no_output = bool(int(self.data['no_output'])) + self.no_reply = bool(int(self.data['noReply'])) diff --git a/tests/test_received_data.py b/tests/test_received_data.py index 18eb1010..18952625 100644 --- a/tests/test_received_data.py +++ b/tests/test_received_data.py @@ -14,41 +14,41 @@ class ReceivedTestData: data: Dict[str, str] text: str file: str - no_output: bool = False + no_reply: bool = False @pytest.mark.parametrize('data', [ ReceivedTestData( - '{"text": "Hello World", "file": "test.py", "no_output": "1"}', - {'text': 'Hello World', 'file': 'test.py', 'no_output': '1'}, + '{"text": "Hello World", "file": "test.py", "noReply": "1"}', + {'text': 'Hello World', 'file': 'test.py', 'noReply': '1'}, 'Hello World', 'test.py', True ), ReceivedTestData( - '{"text": "Hello World", "file": "test.py", "no_output": "0"}', - {'text': 'Hello World', 'file': 'test.py', 'no_output': '0'}, + '{"text": "Hello World", "file": "test.py", "noReply": "0"}', + {'text': 'Hello World', 'file': 'test.py', 'noReply': '0'}, 'Hello World', 'test.py', False ), ReceivedTestData( '{"text": "Hello World", "file": ""}', - {'text': 'Hello World', 'file': '', 'no_output': '0'}, + {'text': 'Hello World', 'file': '', 'noReply': '0'}, 'Hello World', '', False ), ReceivedTestData( '{"text": "Hello World"}', - {'text': 'Hello World', 'file': '', 'no_output': '0'}, + {'text': 'Hello World', 'file': '', 'noReply': '0'}, 'Hello World', '', False ), ReceivedTestData( '{"text": "",', - {'text': '', 'file': '', 'no_output': '0'}, + {'text': '', 'file': '', 'noReply': '0'}, '', '', False @@ -62,4 +62,4 @@ def test_received_data(data: ReceivedTestData): assert received.data == data.data assert received.text == data.text assert received.file == data.file - assert received.no_output == data.no_output + assert received.no_reply == data.no_reply