ReadTheDocs fixes

This commit is contained in:
Fabio Manganiello 2020-08-24 01:14:40 +02:00
parent 5d2e74eb97
commit 2e6388f6f4
17 changed files with 236 additions and 258 deletions

View file

@ -6,7 +6,6 @@ Events
:maxdepth: 2 :maxdepth: 2
:caption: Events: :caption: Events:
platypush/events/.rst
platypush/events/adafruit.rst platypush/events/adafruit.rst
platypush/events/alarm.rst platypush/events/alarm.rst
platypush/events/application.rst platypush/events/application.rst

View file

@ -1,5 +0,0 @@
``platypush.backend.stt.picovoice``
===================================
.. automodule:: platypush.backend.stt.picovoice
:members:

View file

@ -1,6 +0,0 @@
``platypush.plugins.google.credentials``
========================================
.. automodule:: platypush.plugins.google.credentials
:members:

View file

@ -1,6 +0,0 @@
``platypush.plugins.media.search.local``
========================================
.. automodule:: platypush.plugins.media.search.local
:members:

View file

@ -1,6 +0,0 @@
``platypush.plugins.media.search.torrent``
==========================================
.. automodule:: platypush.plugins.media.search.torrent
:members:

View file

@ -1,6 +0,0 @@
``platypush.plugins.media.search.youtube``
==========================================
.. automodule:: platypush.plugins.media.search.youtube
:members:

View file

@ -10,13 +10,18 @@ class Response(Message):
def __init__(self, target=None, origin=None, id=None, output=None, errors=None, def __init__(self, target=None, origin=None, id=None, output=None, errors=None,
timestamp=None, disable_logging=False): timestamp=None, disable_logging=False):
""" """
Params: :param target: Target
target -- Target [String] :type target: str
origin -- Origin [String] :param origin: Origin
output -- Output [String] :type origin: str
errors -- Errors [List of strings or exceptions] :param output: Output
id -- Message ID this response refers to :type output: str
timestamp -- Message timestamp [Float] :param errors: Errors
:type errors: list
:param id: Message ID this response refers to
:type id: str
:param timestamp: Message timestamp
:type timestamp: float
""" """
super().__init__(timestamp=timestamp) super().__init__(timestamp=timestamp)
@ -63,7 +68,7 @@ class Response(Message):
def __str__(self): def __str__(self):
""" """
Overrides the str() operator and converts Overrides the ``str()`` operator and converts
the message into a UTF-8 JSON string the message into a UTF-8 JSON string
""" """
output = self.output if self.output is not None else { output = self.output if self.output is not None else {

View file

@ -43,7 +43,9 @@ class BluetoothLookupNameResponse(BluetoothResponse):
class BluetoothLookupServiceResponse(BluetoothResponse): class BluetoothLookupServiceResponse(BluetoothResponse):
""" """
Example services response output:: Example services response output:
.. code-block:: json
[ [
{ {
@ -92,6 +94,7 @@ class BluetoothLookupServiceResponse(BluetoothResponse):
"host": "00:11:22:33:44:57" "host": "00:11:22:33:44:57"
} }
] ]
""" """
def __init__(self, services: list, *args, **kwargs): def __init__(self, services: list, *args, **kwargs):
self.services = services self.services = services
@ -100,7 +103,9 @@ class BluetoothLookupServiceResponse(BluetoothResponse):
class BluetoothDiscoverPrimaryResponse(BluetoothResponse): class BluetoothDiscoverPrimaryResponse(BluetoothResponse):
""" """
Example services response output:: Example services response output:
.. code-block:: json
[ [
{ {
@ -133,7 +138,9 @@ class BluetoothDiscoverPrimaryResponse(BluetoothResponse):
class BluetoothDiscoverCharacteristicsResponse(BluetoothResponse): class BluetoothDiscoverCharacteristicsResponse(BluetoothResponse):
""" """
Example services response output:: Example services response output:
.. code-block:: json
[ [
{ {

View file

@ -5,7 +5,7 @@ from platypush.message.response.camera import CameraResponse
class AndroidCameraStatusResponse(CameraResponse): class AndroidCameraStatusResponse(CameraResponse):
""" """
Sample response:: Example response:
.. code-block:: json .. code-block:: json

View file

@ -34,6 +34,7 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin):
* **tenacity** (``pip install tenacity``) * **tenacity** (``pip install tenacity``)
* **google-assistant-sdk** (``pip install google-assistant-sdk[samples]``) * **google-assistant-sdk** (``pip install google-assistant-sdk[samples]``)
""" """
api_endpoint = 'embeddedassistant.googleapis.com' api_endpoint = 'embeddedassistant.googleapis.com'
@ -214,7 +215,6 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin):
:param language: Language code override (default: default configured language). :param language: Language code override (default: default configured language).
:param tts_plugin: Optional text-to-speech plugin to be used for rendering text. :param tts_plugin: Optional text-to-speech plugin to be used for rendering text.
:param tts_args: Optional arguments for the TTS plugin say method. :param tts_args: Optional arguments for the TTS plugin say method.
:returns: A list of the interactions that happen within the conversation. :returns: A list of the interactions that happen within the conversation.
..code-block:: json ..code-block:: json
@ -223,13 +223,10 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin):
{ {
"request": "request 1", "request": "request 1",
"response": "response 1" "response": "response 1"
}, },
{ {
"request": "request 2", "request": "request 2",
"response": "response 2" "response": "response 2"
} }
] ]

View file

@ -75,7 +75,7 @@ class FoursquarePlugin(Plugin):
:param query: Search query (e.g. "coffee shops" or "restaurants"). :param query: Search query (e.g. "coffee shops" or "restaurants").
:param limit: Maximum number of results. :param limit: Maximum number of results.
:param url: Venue URL to search. :param url: Venue URL to search.
:param categories: List of ``category IDs <https://developer.foursquare.com/docs/resources/categories>``_ :param categories: List of `category IDs <https://developer.foursquare.com/docs/resources/categories>`_
to be searched. to be searched.
:param radius: Search radius in meters. :param radius: Search radius in meters.
:param sw: South/west boundary box as a ``[latitude, longitude]`` pair. :param sw: South/west boundary box as a ``[latitude, longitude]`` pair.
@ -157,7 +157,7 @@ class FoursquarePlugin(Plugin):
:param query: Search query (e.g. "coffee shops" or "restaurants"). The parameter has no effect if :param query: Search query (e.g. "coffee shops" or "restaurants"). The parameter has no effect if
``section`` is specified. ``section`` is specified.
:param limit: Maximum number of results. :param limit: Maximum number of results.
:param categories: List of ``category IDs <https://developer.foursquare.com/docs/resources/categories>``_ :param categories: List of `category IDs <https://developer.foursquare.com/docs/resources/categories>`_
to be searched. to be searched.
:param radius: Search radius in meters. :param radius: Search radius in meters.
:param open_now: Filter by open/not open now. :param open_now: Filter by open/not open now.

View file

@ -16,13 +16,13 @@ class GoogleTranslatePlugin(Plugin):
1. Create a project on the `Google Cloud console <https://console.cloud.google.com/projectcreate>`_ if 1. Create a project on the `Google Cloud console <https://console.cloud.google.com/projectcreate>`_ if
you don't have one already. you don't have one already.
2. In the menu navigate to the _Artificial Intelligence_ section and select _Translations_ and enable the API. 2. In the menu navigate to the *Artificial Intelligence* section and select *Translations* and enable the API.
3. From the menu select _APIs & Services_ and create a service account. You can leave role and permissions 3. From the menu select *APIs & Services* and create a service account. You can leave role and permissions
empty. empty.
4. Create a new private JSON key for the service account and download it. By default platypush will look for the 4. Create a new private JSON key for the service account and download it. By default platypush will look for the
credentials file under ~/.credentials/platypush/google/translate.json. credentials file under ``~/.credentials/platypush/google/translate.json``.
Requires: Requires:

View file

@ -22,7 +22,7 @@ class GpioSensorLtr559Plugin(GpioSensorPlugin):
:returns: dict. Example: :returns: dict. Example:
.. code-block:: python .. code-block:: python
:
output = { output = {
"light": 109.3543, # Lux "light": 109.3543, # Lux
"proximity": 103 # The higher the value, the nearest the object, within a ~5cm range "proximity": 103 # The higher the value, the nearest the object, within a ~5cm range

View file

@ -1,7 +1,6 @@
import os import os
from typing import Optional, Union from typing import Optional, Union
import deepspeech
import numpy as np import numpy as np
import wave import wave
@ -79,6 +78,7 @@ class SttDeepspeechPlugin(SttPlugin):
:param block_duration: Duration of the acquired audio blocks (default: 1 second). :param block_duration: Duration of the acquired audio blocks (default: 1 second).
""" """
import deepspeech
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.model_file = os.path.abspath(os.path.expanduser(model_file)) self.model_file = os.path.abspath(os.path.expanduser(model_file))
self.lm_file = os.path.abspath(os.path.expanduser(lm_file)) self.lm_file = os.path.abspath(os.path.expanduser(lm_file))
@ -89,7 +89,8 @@ class SttDeepspeechPlugin(SttPlugin):
self._model: Optional[deepspeech.Model] = None self._model: Optional[deepspeech.Model] = None
self._context = None self._context = None
def _get_model(self) -> deepspeech.Model: def _get_model(self):
import deepspeech
if not self._model: if not self._model:
self._model = deepspeech.Model(self.model_file, self.beam_width) self._model = deepspeech.Model(self.model_file, self.beam_width)
self._model.enableDecoderWithLM(self.lm_file, self.trie_file, self.lm_alpha, self.lm_beta) self._model.enableDecoderWithLM(self.lm_file, self.trie_file, self.lm_alpha, self.lm_beta)

View file

@ -86,8 +86,7 @@ class ZeroconfPlugin(Plugin):
:param service: Service type (e.g. ``_http._tcp.local.``). :param service: Service type (e.g. ``_http._tcp.local.``).
:param timeout: Browser timeout in seconds (default: 5). Specify None for no timeout - in such case the :param timeout: Browser timeout in seconds (default: 5). Specify None for no timeout - in such case the
discovery will loop forever and generate events upon service changes. discovery will loop forever and generate events upon service changes.
:return: A ``service_type -> [service_names]`` mapping. Example:: :return: A ``service_type -> [service_names]`` mapping. Example:
.. code-block:: json .. code-block:: json
@ -109,8 +108,7 @@ class ZeroconfPlugin(Plugin):
"server": "host1._platypush-http._tcp.local.", "server": "host1._platypush-http._tcp.local.",
"weight": 0 "weight": 0
} }
}, }
...
} }
""" """

View file

@ -19,7 +19,7 @@ class ZigbeeMqttPlugin(MqttPlugin):
- Install `cc-tool <https://github.com/dashesy/cc-tool>`_ either from sources or from a package manager. - Install `cc-tool <https://github.com/dashesy/cc-tool>`_ either from sources or from a package manager.
- Connect the Zigbee to your PC/RaspberryPi in this way: USB -> CC debugger -> downloader cable -> CC2531 -> USB. - Connect the Zigbee to your PC/RaspberryPi in this way: USB -> CC debugger -> downloader cable -> CC2531 -> USB.
The debugger and the adapter should be connected _at the same time_. If the later ``cc-tool`` command throws up The debugger and the adapter should be connected *at the same time*. If the later ``cc-tool`` command throws up
an error, put the device in sync while connected by pressing the _Reset_ button on the debugger. an error, put the device in sync while connected by pressing the _Reset_ button on the debugger.
- Check where the device is mapped. On Linux it will usually be ``/dev/ttyACM0``. - Check where the device is mapped. On Linux it will usually be ``/dev/ttyACM0``.
- Download the latest `Z-Stack firmware <https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator>`_ to your device. - Download the latest `Z-Stack firmware <https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator>`_ to your device.