Skip to content

Commit

Permalink
Finish up docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Moosems committed Jul 29, 2024
1 parent ab28d03 commit dc60140
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 20 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
7 changes: 1 addition & 6 deletions collegamento/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 2 additions & 5 deletions collegamento/files_variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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,
}
Expand Down
11 changes: 7 additions & 4 deletions docs/source/classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -32,14 +32,17 @@ 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:

``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.
2 changes: 1 addition & 1 deletion docs/source/examples/simple_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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?")
Expand Down
3 changes: 2 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand All @@ -14,5 +14,6 @@ Welcome to ``Collegamento``'s Documentation! ``Collegamento`` is a library that

installation
example-usage
variables
classes
examples
2 changes: 1 addition & 1 deletion docs/source/variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit dc60140

Please sign in to comment.