diff --git a/demos/python/sdk_wireless_camera_control/docs/conf.py b/demos/python/sdk_wireless_camera_control/docs/conf.py index ce104d99..b93f3390 100644 --- a/demos/python/sdk_wireless_camera_control/docs/conf.py +++ b/demos/python/sdk_wireless_camera_control/docs/conf.py @@ -67,6 +67,12 @@ "ResponseType": "open_gopro.types.ResponseType", "Protobuf": "open_gopro.types.Protobuf", "IdType": "open_gopro.types.IdType", + # TODO there must be a better way of doing this... + "Params.Toggle": "open_gopro.api.params.Toggle", + "Params.CameraControl": "open_gopro.api.params.CameraControl", + "Params.WebcamProtocol": "open_gopro.api.params.WebcamProtocol", + "Params.WebcamResolution": "open_gopro.api.params.WebcamResolution", + "Params.WebcamFOV": "open_gopro.api.params.WebcamFOV", } # This is very broken. @@ -82,9 +88,13 @@ ("py:class", "T_co"), ("py:class", "ExceptionHandler"), ("py:class", "abc.ABC"), + # TODO need to fix these + ("py:class", "Path"), + ("py:class", "JsonDict"), + ("py:class", "ValueType"), ] nitpick_ignore_regex = [ - (r"py:class", r".*proto\..+"), # TODO how should / can we handle protobuf documenting? + (r"py:class", r".*proto\..+"), (r"py:class", r".*_pb2\..+"), (r".*", r".*construct.*"), # Generic Types that are pointless to document @@ -94,8 +104,12 @@ (r"py:class", r".*BleDevice"), (r"py:class", r".*CommunicatorType"), (r"py:class", r".*NotiHandlerType"), + (r"py:class", r".*DisconnectHandlerType"), (r"py:obj", r".*CommunicatorType"), - (r"py:obj", r".*MessageType"), + (r"py:class", r".*QueryParserType"), + (r"py:class", r".*ValueType"), + (r"py:obj", r".*communicator_interface.MessageType"), + (r"py:class", r".*dataclasses.*"), ] @@ -109,19 +123,12 @@ def resolve_type_aliases(app, env, node, contnode): """Resolve :class: references to our type aliases as :attr: instead.""" try: if node["refdomain"] == "py" and (target := TYPE_ALIASES.get(node["reftarget"])): - print(f"updating {node['reftarget']}") - return app.env.get_domain("py").resolve_any_xref( - env, - node["refdoc"], - app.builder, - target, - node, - contnode, - )[ + # print(f"updating {node['reftarget']}") + return app.env.get_domain("py").resolve_any_xref(env, node["refdoc"], app.builder, target, node, contnode,)[ 0 ][1] except IndexError: - print("uhoh") + # print("Error") return None diff --git a/demos/python/sdk_wireless_camera_control/noxfile.py b/demos/python/sdk_wireless_camera_control/noxfile.py index 082f2694..e908e20e 100644 --- a/demos/python/sdk_wireless_camera_control/noxfile.py +++ b/demos/python/sdk_wireless_camera_control/noxfile.py @@ -62,10 +62,10 @@ def tests(session) -> None: @session(python=SUPPORTED_VERSIONS[-1]) def docstrings(session) -> None: """Validate docstrings.""" - session.install("darglint") + session.install("pydoclint") session.install("pydocstyle[toml]") session.run("pydocstyle", "open_gopro") - session.run("darglint", "open_gopro") + session.run("pydoclint", "open_gopro") @session(python=SUPPORTED_VERSIONS[-1]) @@ -78,7 +78,7 @@ def docs(session) -> None: "sphinx-rtd-theme", "sphinxcontrib-napoleon", "autodoc-pydantic", - "darglint", + "pydoclint", ) session.run("sphinx-build", "-W", "docs", "docs/build") # Clean up for Jekyll consumption diff --git a/demos/python/sdk_wireless_camera_control/open_gopro/communicator_interface.py b/demos/python/sdk_wireless_camera_control/open_gopro/communicator_interface.py index ae67d446..559067e3 100644 --- a/demos/python/sdk_wireless_camera_control/open_gopro/communicator_interface.py +++ b/demos/python/sdk_wireless_camera_control/open_gopro/communicator_interface.py @@ -519,6 +519,7 @@ def build_url(self, **kwargs: Any) -> str: CommunicatorType = TypeVar("CommunicatorType", bound=BaseGoProCommunicator) + class Messages(ABC, dict, Generic[MessageType, CommunicatorType]): """Base class for setting and status containers diff --git a/demos/python/sdk_wireless_camera_control/tests/conftest.py b/demos/python/sdk_wireless_camera_control/tests/conftest.py index 4d801179..cb0dd3af 100644 --- a/demos/python/sdk_wireless_camera_control/tests/conftest.py +++ b/demos/python/sdk_wireless_camera_control/tests/conftest.py @@ -49,7 +49,7 @@ from open_gopro.gopro_base import GoProBase from open_gopro.logger import set_logging_level, setup_logging from open_gopro.models.response import GoProResp -from open_gopro.types import UpdateCb, UpdateType, CameraState +from open_gopro.types import CameraState, UpdateCb, UpdateType from open_gopro.wifi import SsidState, WifiClient, WifiController from tests import mock_good_response, versions diff --git a/demos/python/sdk_wireless_camera_control/tests/unit/test_wireless_gopro.py b/demos/python/sdk_wireless_camera_control/tests/unit/test_wireless_gopro.py index 9b7d4edc..88e4ca32 100644 --- a/demos/python/sdk_wireless_camera_control/tests/unit/test_wireless_gopro.py +++ b/demos/python/sdk_wireless_camera_control/tests/unit/test_wireless_gopro.py @@ -13,12 +13,12 @@ import requests import requests_mock -from open_gopro.types import UpdateType from open_gopro.communicator_interface import HttpMessage from open_gopro.constants import ErrorCode, QueryCmdId, SettingId, StatusId from open_gopro.exceptions import GoProNotOpened, ResponseTimeout from open_gopro.gopro_wireless import Params, WirelessGoPro from open_gopro.models.response import GlobalParsers, GoProResp +from open_gopro.types import UpdateType from tests import mock_good_response