Skip to content

Commit

Permalink
fix readthedocs build
Browse files Browse the repository at this point in the history
  • Loading branch information
bakatrouble committed Feb 19, 2019
1 parent 4cefda2 commit 7dd7332
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 23 deletions.
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@

autodoc_member_order = 'bysource'

autodoc_mock_imports = ['_tgvoip']


# -- Options for HTML output -------------------------------------------------

Expand Down
43 changes: 39 additions & 4 deletions docs/module/tgvoip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,43 @@ Enums
Data structures
---------------

.. autoclass:: tgvoip.Stats
:members:

.. autoclass:: tgvoip.Endpoint
:members:
.. py:class:: tgvoip.Stats
Object storing call stats

.. attribute:: bytes_sent_wifi

Amount of data sent over WiFi
:type: ``int``

.. attribute:: bytes_sent_mobile

Amount of data sent over mobile network
:type: ``int``

.. attribute:: bytes_recvd_wifi

Amount of data received over WiFi
:type: ``int``

.. attribute:: bytes_recvd_mobile

Amount of data received over mobile network
:type: ``int``


.. py:class:: tgvoip.Endpoint
Object storing endpoint info

:param _id: Endpoint ID
:type _id: ``int``
:param ip: Endpoint IPv4 address
:type ip: ``str``
:param ipv6: Endpoint IPv6 address
:type ipv6: ``str``
:param port: Endpoint port
:type port: ``int``
:param peer_tag: Endpoint peer tag
:type peer_tag: ``bytes``
21 changes: 2 additions & 19 deletions src/_tgvoip_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,7 @@ PYBIND11_MODULE(_tgvoip, m) {
.value("PROXY", CallError::ERROR_PROXY)
.export_values();

py::class_<Stats>(m, "Stats", R"doc(
An object storing call stats
Attributes:
bytes_sent_wifi (``int``): Amount of data sent over WiFi
bytes_sent_mobile (``int``): Amount of data sent over mobile network
bytes_recvd_wifi (``int``): Amount of data received over WiFi
bytes_recvd_mobile (``int``): Amount of data received over mobile network
)doc")
py::class_<Stats>(m, "Stats")
.def_readonly("bytes_sent_wifi", &Stats::bytes_sent_wifi)
.def_readonly("bytes_sent_mobile", &Stats::bytes_sent_mobile)
.def_readonly("bytes_recvd_wifi", &Stats::bytes_recvd_wifi)
Expand All @@ -95,16 +87,7 @@ PYBIND11_MODULE(_tgvoip, m) {
return repr.str();
});

py::class_<Endpoint>(m, "Endpoint", R"doc(
An object storing endpoint info
Args:
_id (``int``): Endpoint ID
ip (``str``): Endpoint IPv4 address
ipv6 (``str``): Endpoint IPv6 address
port (``int``): Endpoint port
peer_tag (``bytes``): Endpoint peer tag
)doc")
py::class_<Endpoint>(m, "Endpoint")
.def(py::init<long, const std::string &, const std::string &, int, const std::string &>())
.def_readwrite("_id", &Endpoint::id)
.def_readwrite("ip", &Endpoint::ip)
Expand Down

0 comments on commit 7dd7332

Please sign in to comment.