Skip to content

Commit

Permalink
Fix sphinx and update nox file
Browse files Browse the repository at this point in the history
  • Loading branch information
tcamise-gpsw committed Jul 19, 2024
1 parent ddc0096 commit 8792bac
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
31 changes: 19 additions & 12 deletions demos/python/sdk_wireless_camera_control/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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.*"),
]


Expand All @@ -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


Expand Down
6 changes: 3 additions & 3 deletions demos/python/sdk_wireless_camera_control/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion demos/python/sdk_wireless_camera_control/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 8792bac

Please sign in to comment.