diff --git a/collegamento/simple_client_server/client.py b/collegamento/simple_client_server/client.py index a457705..3cf7208 100644 --- a/collegamento/simple_client_server/client.py +++ b/collegamento/simple_client_server/client.py @@ -19,7 +19,6 @@ class SimpleClient: - SimpleClient.notify_server() - SimpleClient.request() - SimpleClient.add_command() - - SimpleClient.cancel_request() - SimpleClient.kill_IPC() """ @@ -107,9 +106,10 @@ def request( """Sends the main_server a request of type command with given kwargs - external API""" self.logger.debug("Beginning request") - # TODO: Should this just be a walrus operator? "(command := request_dict["command"])" - command: str = request_details["command"] - if command not in self.commands: + # NOTE: this variable could've been a standalone line but I thought it would just be better + # to use the walrus operator. No point in a language feature if its never used. Plus, + # it also looks quite nice :D + if (command := request_details["command"]) not in self.commands: self.logger.exception( f"Command {command} not in builtin commands. Those are {self.commands}!" ) @@ -133,19 +133,6 @@ def request( self.requests_queue.put(final_request) self.logger.info("Message sent") - def cancel_request(self, command: str) -> None: - """Cancels a request of type command - external API""" - if command not in self.commands: - self.logger.exception( - f"Cannot cancel command {command}, valid commands are {self.commands}" - ) - raise CollegamentoError( - f"Cannot cancel command {command}, valid commands are {self.commands}" - ) - - self.logger.info(f"Cancelled command: {command}") - self.current_ids[command] = 0 - def parse_response(self, res: Response) -> None: """Parses main_server output line and discards useless responses - internal API""" self.logger.debug("Parsing server response") diff --git a/docs/source/classes.rst b/docs/source/classes.rst index a387389..67cb34d 100644 --- a/docs/source/classes.rst +++ b/docs/source/classes.rst @@ -33,8 +33,6 @@ The ``SimpleClient`` class can do: - ``SimpleClient.notify_server(notification_dict: dict)`` (as a base class, this has no use case, but it will likely be used by any given subclass) - ``SimpleClient.request(request_details: dict)`` (all details in request_details are specific to the command in the request_details) - ``SimpleClient.add_command(name: str, command: USER_FUNCTION)`` (adds the function with the name provided that takes input of ``Request`` and returns anything`` -- ``SimpleClient.cancel_request(command: str)`` (will not give output for any requests of type command. When is this ever used? No idea! Why? Because it doesn't actually stop the server from completing it) -TODO: remove this stupid feature. No point in it. - ``SimpleClient.kill_IPC()`` (kills the IPC server) .. _FileClient Overview: