From dc60140199f71af4d4aa13ea06b9fab77f637f44 Mon Sep 17 00:00:00 2001 From: Moosems <95927277+Moosems@users.noreply.github.com> Date: Mon, 29 Jul 2024 01:46:34 -0600 Subject: [PATCH] Finish up docs --- README.md | 2 -- collegamento/__init__.py | 7 +------ collegamento/files_variant.py | 7 ++----- docs/source/classes.rst | 11 +++++++---- docs/source/examples/simple_example.rst | 2 +- docs/source/index.rst | 3 ++- docs/source/variables.rst | 2 +- 7 files changed, 14 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 762c257..2ea1ac9 100644 --- a/README.md +++ b/README.md @@ -22,5 +22,3 @@ Currently 3.11 is the minimum (instead of 3.10) as this was developed under 3.12 ## License This project is licensed under the MIT License - see the [LICENSE](./LICENSE). - -Keywords to `git grep` for when using template are `xyz` and `PROJECT_NAME` diff --git a/collegamento/__init__.py b/collegamento/__init__.py index 609381e..2731795 100644 --- a/collegamento/__init__.py +++ b/collegamento/__init__.py @@ -2,12 +2,7 @@ beartype_this_package() -from .files_variant import ( # noqa: F401, E402 - FileClient, - FileNotification, - FileRequest, - FileServer, -) +from .files_variant import FileClient, FileServer # noqa: F401, E402 from .simple_client_server import ( # noqa: F401, E402 USER_FUNCTION, CollegamentoError, diff --git a/collegamento/files_variant.py b/collegamento/files_variant.py index 0a869d2..3ac5d8b 100644 --- a/collegamento/files_variant.py +++ b/collegamento/files_variant.py @@ -55,7 +55,7 @@ def update_file(self, file: str, current_state: str) -> None: self.files[file] = current_state self.logger.debug("Creating notification dict") - notification: FileNotification = { # type: ignore + notification: dict = { "file": file, "remove": False, "contents": self.files[file], @@ -75,10 +75,7 @@ def remove_file(self, file: str) -> None: ) self.logger.info("Notifying server of file deletion") - # self.create_message("notification", remove=True, file=file) - notification: FileNotification = { - "id": super().create_message_id(), - "type": "notification", + notification: dict = { "file": file, "remove": True, } diff --git a/docs/source/classes.rst b/docs/source/classes.rst index 67cb34d..c353fd4 100644 --- a/docs/source/classes.rst +++ b/docs/source/classes.rst @@ -21,7 +21,7 @@ The ``Request`` class is a TypedDict meant to provide a framework for items give ``Response`` ************ -The ``Response`` class is what is returned by the ``SimpleClient`` or one of it's variants to the user. The useful data is found at ``some_response["result"]``. +The ``Response`` class is what is returned by the "ref:`SimpleClient Overview` or one of it's variants to the user. The useful data is found at ``some_response["result"]``. .. _SimpleClient Overview: @@ -32,7 +32,7 @@ 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.add_command(name: str, command: USER_FUNCTION)`` (adds the function with the name provided that takes input of :ref:`Request Overview` and returns anything`` - ``SimpleClient.kill_IPC()`` (kills the IPC server) .. _FileClient Overview: @@ -40,6 +40,9 @@ The ``SimpleClient`` class can do: ``FileClient`` ************** -``FileClient`` can do: +``FileClient`` has the additional methods: -- ``xyz`` +- ``FileClient.update_file(file: str, current_state: str)`` (adds or updates the file with the new contents and notifies server of changes) +- ``FileClient.remove_file(file: str)`` (removes the file specified from the system and notifies the server to fo the same) + +This class also has some changed functionality. When you make a ``.request()`` and add a file to the request, it chnages the request's name to its contents for the function to use. diff --git a/docs/source/examples/simple_example.rst b/docs/source/examples/simple_example.rst index 7226e75..e58ff13 100644 --- a/docs/source/examples/simple_example.rst +++ b/docs/source/examples/simple_example.rst @@ -24,7 +24,7 @@ Simple Example sleep(1) output: Response | None = context.get_response("test") - if output is not None and output["result"] == True: # type: ignore + if output is not None and output["result"]: # type: ignore print("Yippee! It worked!") else: print("Aww, maybe your compute is just a little slow?") diff --git a/docs/source/index.rst b/docs/source/index.rst index 71d6f2c..222f5ef 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -2,7 +2,7 @@ ``Collegamento`` Documentation ============================== -Welcome to ``Collegamento``'s Documentation! ``Collegamento`` is a library that can be to do xyz. To get started with ``Collegamento``, visit the :doc:`installation` page! +Welcome to ``Collegamento``'s Documentation! ``Collegamento`` is a library that can be used for Client/Server IPC's with the goal of offloading major workloads to a second process. To get started with ``Collegamento``, visit the :doc:`installation` page! .. note:: @@ -14,5 +14,6 @@ Welcome to ``Collegamento``'s Documentation! ``Collegamento`` is a library that installation example-usage + variables classes examples diff --git a/docs/source/variables.rst b/docs/source/variables.rst index eada3c8..7161d8f 100644 --- a/docs/source/variables.rst +++ b/docs/source/variables.rst @@ -7,4 +7,4 @@ Variables ``USER_FUNCTION`` ***************** -USER_FUNCTION does xyz +``USER_FUNCTION`` is a type variable that simply states that any function that matches this type takes in a :ref:`Request Overview` class and returns anything or even nothing.